Italian Trulli

How to Display all the Table From Database in SQL

Test Tribe
.

How to Display all the Tables from a Database in SQL?

All the databases have their own SQL Statement to display all tables from the database in this tutorial we are going to learn How do I get list of all tables in a database? SQL Server, Oracle, and My SQL database.

How to display all the tables from a database in SQL Server?

SQL Server

In SQL Server we have four different ways to get all table names from the database.

Way 1: To display all table names from a database. 

SELECT table_name 
FROM INFORMATION_SCHEMA.TABLES 
WHERE table_type = 'BASE TABLE'

Way 2: To display all table names from a database.

SELECT name 
FROM sys.tables

Way 3: To display all table names from a database.

SELECT name 
FROM sysobjects 
WHERE xtype = 'U'

Way 4: To display all table names from a database.

SELECT name 
FROM sys.objects 
WHERE type_desc = 'USER_TABLE'

How to Display all the tables from a database in Oracle?

Oracle
In Oracle, there are three different ways to display all the tables available in the database.

Way 1: To display all table names from a database (oracle).

SELECT table_name 
FROM dba_tables

Way 2: To display all table names from a database (oracle).

SELECT table_name 
FROM all_tables

Way 3: To display all table names from a database (oracle).

SELECT table_name 
FROM user_tables


How to Display all the tables from a database in My SQL?

My SQL

There are two different ways to display all the tables from the database in My SQL.

Way 1: To display all table names from a database (My SQL).

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

The above SQL Statement will display all the tables in all databases.

Way 2: To display all table names from a database (My SQL).

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

The above SQL Statement will display all the tables in a particular database


Hope !!! The above tutorial on "Display all the column names from the database" is helpful for you...

Team,
QA acharya

Tags: How to get all the tables from the database, SQL query to Get all tables from the database, database tables,SQL List All tables,SQL query to list all tables in a database sql server, how to get all table names in sql sql show

How to Display all the Table From Database in SQL


Post a Comment

0 Comments