SHOW TABLES & DESCRIBE
In this page:
Showing All Tables
SHOW TABLES lists every table that exists in the currently selected database, which is usually the first command you run when getting oriented inside an unfamiliar schema.
Example: Showing All Tables
SHOW TABLES;
Getting Table Metadata with DESCRIBE
DESCRIBE reveals a table's structure at a glance — its column names, their data types, and whether each column is allowed to hold NULL — without needing to open the original CREATE TABLE statement.
Example: Getting Table Metadata with DESCRIBE
CREATE TABLE users (id INT, email TEXT, active BOOLEAN);
DESCRIBE users;
Showing Table Status
SHOW TABLE STATUS surfaces operational details about a table, including its storage engine, how many rows it holds, and when it was created, which is useful for diagnosing performance or storage questions.
Example: Showing Table Status
SHOW TABLE STATUS LIKE 'users';
Showing the CREATE TABLE Statement
Asking MySQL to show the exact CREATE TABLE statement used to build a table is the fastest way to recreate that same structure on another server without manually reverse-engineering it column by column.
Example: Showing the CREATE TABLE Statement
CREATE TABLE users (id INT, email TEXT);
SHOW CREATE TABLE users;
Showing Columns and Indexes
Inspecting a table's columns and indexes together helps confirm that the right keys are in place to speed up the queries you actually run, rather than assuming indexing is correct without checking.
Example: Showing Columns and Indexes
CREATE TABLE users (id INT, email TEXT);
CREATE INDEX idx_email ON users (email);
SHOW COLUMNS FROM users;
SHOW INDEX FROM users;
Chapter Quiz — Complete all 5 topics to unlock
0/5 topics done
Complete these topics first: