Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get table names from a database

Tags:

sql

mysql

I've searched through a bunch of websites and I have not come across any code or tutorial which has gone through the specifics of obtaining the table names from a single database.

Assuming I have 4 databases and I want the names of all the tables within the database called mp21, what query can I use?

like image 396
rollin340 Avatar asked Jan 10 '11 09:01

rollin340


People also ask

How do I get a list of table names from schema?

The easiest way to find all tables in SQL is to query the INFORMATION_SCHEMA views. You do this by specifying the information schema, then the “tables” view. Here's an example. SELECT table_name, table_schema, table_type FROM information_schema.

How do I get a list of table names in MySQL?

The syntax to get all table names with the help of SELECT statement. mysql> use test; Database changed mysql> SELECT Table_name as TablesName from information_schema. tables where table_schema = 'test'; Output with the name of the three tables.

How do I see all the tables present in a database?

If the user is SYSTEM or has access to dba_tables data dictionary view, then use the given below query: Query: SELECT owner, table_name FROM dba_tables; This query returns the following list of tables that contain all the tables that are there in the entire database.


1 Answers

SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
like image 133
stian.net Avatar answered Oct 13 '22 01:10

stian.net