In this post I will share how to get the list of tables in mysql using 2 methods, the first one with the show
sentence and the second with the information_schema
1. Using Show sentence
This is pretty straight forward just do the next sql query
-- Select your database
SHOW TABLES;
And then you will get the list of tables.
2. Using the information_schema
For this one we will use the information_schema.
SELECT
TABLE_NAME
FROM information_schema.tables
WHERE
TABLE_SCHEMA = 'our_db'
Here the our_db
after the TABLE_SCHEMA
is the name of our database where we want to get the list of tables.
Top comments (0)