Total Page Preview: 000000151339
How to get List names of all tables in SQL Server , MySQL and Oracle
Get name of all tables from database in SQL SERVER, MYSQL and Oracle .
SQL SERVER :-
SELECT * FROM sys.Tables
or
SELECT name AS 'Table Name' FROM sys.Tables
or
SELECT * FROM INFORMATION_SCHEMA.TABLES
OUTPUT:
My-SQL:-
SELECT * FROM information_schema.tables WHERE table_type = 'BASE TABLE';
information_schema.tables has following columns which one can use to get all required information
TABLE_SCHEMA:
This column store name of db schema or in general database name.
TBALE_NAME
This column stores table name along with db schema name in that row.
TABLE_TYPE
This column contains table type name like system view, view or base table.
Other columns many be useful for purposes.
OUTPUT :
Oracle :-
There are three different virtual views you can query to get a list of all available tables. Depending you the permissions you've got, you might not be able to query all of them. If one doesn't work, try the next one.
This query returns a complete list of tables:
SELECT owner, table_name FROM dba_tables;
In case you can't access this view, try this:
SELECT owner, table_name FROM all_tables;
If it still doesn't work, try this, but note that this will return a list of table owned by the current user, not all tables in the database:
SELECT table_name FROM user_tables
Thanks!
Thank You
About Author
Brijesh Kumar
Database Developer
I have more then 6 years Experience in Microsoft Technologies - SQL Server Database, ETL
Azure Cloud - Azure SQL Database, CosmosDB, Azure Data Factory, PowerBI, Web Job, Azure Function, Azure Storage, Web Apps, Powershall
and Database Migration On-Premise to Azure Cloud.
LinkedIn : https://www.linkedin.com