Administration

SQL Information schema and catalogs

Query metadata views to inspect tables, columns and constraints.

Availability: Common SQL with references for SQL standard, MySQL/MariaDB, PostgreSQL, SQL Server, SQLite and Oracle Database; syntax and feature support vary by engine and version.中文

Syntax

SELECT ... FROM information_schema.tables / columns;

Examples

Query metadata views to inspect tables, columns and constraints.

SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

SQLite-oriented example; consult the relevant dialect manual.

SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';

Parameters, options and clauses

Option / clauseDescription
EXPLAINShow the optimizer's planned execution strategy.
ANALYZESome engines execute the statement and report actual statistics; this can run the query.
FORMATChoose plan output format where supported.
Catalog / information schemaInspect objects and definitions through system metadata.
Dialect / versionCheck the linked database manual for vendor-specific behaviour.

Dialect references

Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory