Open In App
Related Articles

How to Get the names of the table in SQL

Improve Article
Improve
Save Article
Save
Like Article
Like

The syntax provided in this article works only for SQL Server and MySQL. 

If you want to know how many tables are present in your database and the details of the table like TABLE_SCHEMA, TABLE_TYPE and all. 

Syntax (When we have only single database): 
 

Select * from schema_name.table_name

Syntax (When we have multiple databases): 

Select * from database_name.schema_name.table_name

Example: 

SELECT * FROM INFORMATION_SCHEMA.TABLES 

WHERE 

1. INFORMATION_SCHEMA views allow you to retrieve metadata about the objects within a database. These views can be found in the master database under Views / System Views and be called from any database in your SQL Server instance. 

2. INFORMATION_SCHEMA.TABLES The INFORMATION_SCHEMA.TABLES view allows you to get information about all tables and views within a database. 

Output: 
 

 

Unlock the Power of Placement Preparation!
Feeling lost in OS, DBMS, CN, SQL, and DSA chaos? Our Complete Interview Preparation Course is the ultimate guide to conquer placements. Trusted by over 100,000+ geeks, this course is your roadmap to interview triumph.
Ready to dive in? Explore our Free Demo Content and join our Complete Interview Preparation course.

Last Updated : 14 Aug, 2020
Like Article
Save Article
Previous
Next
Similar Reads