SQL Show Tables: List All Tables in MySQL, SQL Server and More

To show all tables in SQL, use the command for your database engine: SHOW TABLES; in MySQL, \dt in PostgreSQL, SELECT name FROM sys.tables; in SQL Server, and SELECT table_name FROM user_tables; in Oracle. The information_schema.tables view works across MySQL, PostgreSQL and SQL Server.

Key Takeaways

  • MySQL gives you SHOW TABLES; as a native shortcut to list every table in the active database.
  • information_schema.tables is an ANSI SQL standard view that works across MySQL, PostgreSQL and MariaDB to list tables.
  • SQL Server uses sys.tables, a system catalog view, to list user-created tables.
  • DESCRIBE tablename; shows column names, data types and constraints for any table in MySQL.
  • Knowing which catalog to query is a basic skill tested in data analyst interviews and database administrator roles alike.

What a Table Is in DBMS

A table in DBMS (Database Management System) is a structured collection of data organised into rows and columns. Each column holds a specific type of data, say a customer’s name or an order date, and each row represents one record. Think of it exactly like a spreadsheet tab, except the database engine enforces rules about what data can go in each cell.

Tables are the core building blocks of relational databases. When engineers at an e-commerce company like Flipkart or a bank like HDFC store transaction data, it lives in tables. A single database can contain dozens or even hundreds of tables, all linked by keys. That’s why being able to list and inspect tables quickly is a non-negotiable skill for anyone working in data or software development.

Key Components of a Database Table

Component What It Means Example
Column (Attribute) A named field with a fixed data type customer_id INT
Row (Record/Tuple) One complete entry in the table A single customer’s details
Primary Key Uniquely identifies each row order_id
Foreign Key Links one table to another customer_id referencing customers
Schema The logical container that holds tables ecommerce_db

If you’re studying BSc Computer Science or working toward an MCA, relational database concepts appear in your DBMS papers and in almost every technical interview. The Stack Overflow Developer Survey 2024 found that MySQL and PostgreSQL are the two most commonly used databases among professional developers globally, with MySQL used by 40.3% of respondents and PostgreSQL by 48.7%. According to DB-Engines.com’s June 2025 ranking, Oracle, MySQL and Microsoft SQL Server hold the top three positions in global relational database popularity, reflecting how widely these systems are deployed in enterprise environments. In India specifically, a 2024 Naukri.com skills report found SQL listed as a required skill in over 65% of data analyst and data engineer job postings, making it the single most demanded technical skill across data roles in the country.

How to List All Tables in MySQL Database

MySQL makes it simple. Once you’ve selected a database with USE database_name;, you just type SHOW TABLES; and MySQL returns every table in that database. It’s the fastest way to get your bearings when you open an unfamiliar schema.

Basic Syntax

The full syntax is:

SHOW TABLES [FROM database_name] [LIKE 'pattern' | WHERE expression];

The FROM clause lets you list tables in a different database without switching to it. The LIKE filter is genuinely useful in production: if a schema has 200 tables and you’re hunting for anything related to orders, SHOW TABLES LIKE '%order%'; narrows it down instantly. That’s a trick experienced DBAs use daily.

Using information_schema in MySQL

information_schema is a virtual database built into MySQL (and most other ANSI-compliant databases) that holds metadata about all your databases, tables, columns and constraints. You don’t create it; it’s always there.

To list tables using it:

SELECT table_name FROM information_schema.tables WHERE table_schema = 'your_database_name' AND table_type = 'BASE TABLE';

The table_type = 'BASE TABLE' filter excludes views, which are virtual tables, not real stored ones. Forgetting that filter is one of the most common mistakes beginners make. They end up confused when they see objects in the list that don’t physically store data.

According to the official MySQL 8.0 documentation, SHOW TABLES is equivalent to querying information_schema.TABLES internally, so both approaches give you the same result.

SQL Query to List Tables in Other Databases

The command you use depends entirely on your database engine. There is no single universal sql show tables command that works everywhere, which is why knowing the right catalog query for each system matters.

PostgreSQL: List All Tables

In the psql command-line client, type \dt to list all tables in the current schema. If you’re running queries programmatically, use:

SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_type = 'BASE TABLE';

PostgreSQL also has its own system catalog at pg_catalog.pg_tables. The query SELECT tablename FROM pg_catalog.pg_tables WHERE schemaname = 'public'; gives the same result and is often faster on very large schemas.

SQL Server: Show All Tables Command

To list tables in SQL Server, query the system catalog view:

SELECT name FROM sys.tables;

Or use the ANSI-standard approach that also works:

SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE';

SQL Server’s sys.tables is more powerful because it includes extra columns like create_date and modify_date, which come in handy during audits. If you’re preparing for a data engineering career, SQL Server skills are directly relevant to roles at Indian IT firms like TCS, Infosys and Wipro.

Oracle Database

Oracle uses a different catalog structure. To list tables owned by the current user:

SELECT table_name FROM user_tables;

To see all tables accessible to your account (not just ones you own):

SELECT table_name, owner FROM all_tables ORDER BY owner, table_name;

Oracle’s official documentation explains that user_tables, all_tables and dba_tables are three separate catalog views with increasing levels of visibility.

SQLite

SQLite does not support a SHOW TABLES command. Instead, query the internal master table:

SELECT name FROM sqlite_master WHERE type='table';

SQLite is widely used in mobile applications and embedded systems, including Android apps, so this query is worth knowing if you work in mobile or lightweight application development.

Quick Reference: SQL Show Tables by Database Engine

Database Engine Command / Query Notes
MySQL / MariaDB SHOW TABLES; Must run USE db_name; first
PostgreSQL \dt or query information_schema.tables \dt works only in psql client
SQL Server SELECT name FROM sys.tables; Or use information_schema.tables
Oracle SELECT table_name FROM user_tables; Use all_tables for broader access
SQLite SELECT name FROM sqlite_master WHERE type='table'; No SHOW TABLES command in SQLite

Inspecting Table Structure After Listing Tables

Knowing a table exists is step one. Step two is understanding what’s inside it. That’s where DESCRIBE and schema queries come in.

Using DESCRIBE in MySQL

In MySQL, DESCRIBE tablename; (or the shorthand DESC tablename;) returns every column’s name, data type, whether it allows NULL values, its key type and any default value. It’s the fastest way to understand a table’s structure before writing a query against it.

A real on-the-job scenario: you inherit a legacy database from a previous developer. You don’t have documentation. Running DESCRIBE orders; immediately tells you whether the order date is stored as a DATE, DATETIME or (unfortunately) a VARCHAR. That one command saves you from writing broken queries.

Checking Structure in PostgreSQL and SQL Server

PostgreSQL doesn’t have a native DESCRIBE command outside of psql, where \d tablename does the job. In SQL Server, you query:

SELECT column_name, data_type, is_nullable FROM information_schema.columns WHERE table_name = 'your_table';

This approach works across both PostgreSQL and SQL Server and is more portable than engine-specific shortcuts. If you’re comfortable with SQL fundamentals and want to connect them to command-line work, our guide on basic Linux commands is a natural next read, since most database servers run on Linux.

What information_schema Actually Is

information_schema is a standard set of read-only views defined by the ISO/IEC SQL standard. Every ANSI-compliant database engine, including MySQL, PostgreSQL, SQL Server and MariaDB, implements it. It contains views like information_schema.tables, information_schema.columns and information_schema.key_column_usage.

Using information_schema queries makes your SQL more portable. If your company migrates from MySQL to PostgreSQL, those catalog queries still work with minimal changes. Engine-specific commands like SHOW TABLES don’t survive that migration without rewriting.

Database skills open doors across roles. Whether you’re looking at data analyst vs data scientist paths or checking jobs and salary after MCA, SQL proficiency consistently appears as a required skill in Indian and global job listings.

Frequently Asked Questions

How do I show all tables in SQL?

The command depends on your database. In MySQL, run SHOW TABLES; after selecting a database. In PostgreSQL, use \dt in psql or query information_schema.tables. In SQL Server, run SELECT name FROM sys.tables;. In Oracle, use SELECT table_name FROM user_tables;. The information_schema.tables view works across MySQL, PostgreSQL and SQL Server.

What is a table in DBMS?

A table in a Database Management System (DBMS) is a structured object that stores data in rows and columns. Each column has a defined data type and name, and each row holds one complete record. Tables are the primary storage units in relational databases like MySQL, PostgreSQL, Oracle and SQL Server.

How do I list tables in SQL Server?

In SQL Server, run SELECT name FROM sys.tables; to list all user-created tables in the current database. You can also use the ANSI-standard query SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE';. The sys.tables view includes extra metadata like creation and modification dates.

How do I describe a table in SQL?

In MySQL and MariaDB, run DESCRIBE tablename; or DESC tablename; to see all columns, their data types, null constraints and key information. In PostgreSQL, use \d tablename in the psql client. In SQL Server, query information_schema.columns with a WHERE table_name = 'your_table' filter.

What is information_schema in SQL?

information_schema is a set of read-only views defined by the ISO/IEC SQL standard that provides metadata about a database’s structure, including its tables, columns, constraints and privileges. It’s built into MySQL, PostgreSQL, SQL Server and MariaDB. Querying it is more portable than using engine-specific commands like SHOW TABLES.

Does SQLite support SHOW TABLES?

No. SQLite does not support the SHOW TABLES command. To list all tables in a SQLite database, run SELECT name FROM sqlite_master WHERE type='table';. This queries SQLite’s internal master table, which stores the schema for all database objects.

Your next steps this week:

  1. Open MySQL Workbench or any SQL client, connect to a database and run SHOW TABLES;, then try the same query using information_schema.tables and compare the output.
  2. Pick one table from the result and run DESCRIBE tablename; to read its column structure. Note which columns are primary keys and which allow NULL values.
  3. Try the equivalent commands in a second database engine, PostgreSQL or SQL Server, using the reference table in this article. Seeing the difference firsthand makes it stick far better than memorising syntax.

Strong SQL fundamentals are the foundation for careers in data engineering, cybersecurity, ethical hacking and AI development. If you want to build on these skills with industry-recognised credentials, explore 3.0 University’s online certification courses in Cybersecurity, AI, Blockchain and Web3. For a structured, practical programme that builds on programming and database knowledge, the CEH v13 AI online course is a strong next move for anyone serious about a career in ethical hacking and secure systems.

Last updated: June 2025. Reviewed by the 3University editorial team.

We create, review, and maintain educational content covering Cybersecurity, Ethical Hacking, Artificial Intelligence, Blockchain, Web3, and emerging technologies.

Read More Articles