SQL SHOW is a metadata-retrieval statement, most widely known in MySQL and MariaDB, that queries the server for information rather than data rows. Depending on the sub-command (e.g., DATABASES, TABLES, INDEX, VARIABLES, STATUS, CREATE TABLE), SHOW can list objects, reveal DDL, expose performance counters, or display configuration parameters. Unlike SELECT queries against INFORMATION_SCHEMA, SHOW is parsed and optimized by the server for speed and sometimes exposes extra details not available elsewhere. SHOW never modifies data and is autocommit-safe.Key behaviors- Executes instantly and does not lock user tables.- Output is returned as a result set that can be piped into other SQL statements (e.g., CREATE TABLE foo AS SELECT * FROM (SHOW TABLES) t) in dialects that allow subquery usage.- Many SHOW variants accept LIKE, WHERE, or FROM clauses to filter results.Caveats- Syntax and supported sub-commands vary across databases. Standard SQL does not define SHOW.- Permissions apply: users need the relevant SHOW privilege or object privilege to view metadata.- In replication setups, SHOW statements run on the connected server only; they are not forwarded.- Some variants (e.g., SHOW CREATE TRIGGER) return a single row; others can return thousands, so use LIMIT or WHERE when possible.
sub-command
(keyword) - The type of metadata to retrieve, such as DATABASES, TABLES, COLUMNS, INDEX, TRIGGERS, EVENTS, VARIABLES, STATUS, WARNINGS, PROCESSLIST, ENGINE, PRIVILEGES, CREATE table_or_view, etc.db_name
(identifier) - Optional database name to scope the request.pattern
(string) - Optional LIKE pattern for server-side filtering.expr
(expression) - Optional WHERE clause for more complex filtering.MySQL 3.23 (1998)
You can list databases, tables, columns, indexes, events, triggers, user privileges, server variables, and full DDL with SHOW CREATE.
Yes. SHOW only reads metadata and is safe on primaries or replicas. Some status values may differ because they are node-specific.
A user needs the SHOW DATABASES privilege to view all schemas. Lacking that, they only see schemas they own. Object-level SHOW variants require SELECT on the object.
INFORMATION_SCHEMA exposes metadata via standard SELECT queries, while SHOW is vendor-native, faster, and sometimes reveals extra fields (e.g., row format).