SHOW DATABASES & SHOW TABLESWe can display the entire database present in the MySQL by using query SHOW DATABASES. Based on your login privilege we can display the list of database.
We will try to display a drop down list box with all database names as options. We will use PHP & PDO with database connection to display list of databases.
Here is the code.
Show Tables of the databaseWe can list out all the tables present inside a database by using SHOW TABLES query. Here is the example of listing all the tables of a database.
Using LIKE queryWe can filter tables based on the part of the name by using LIKE query.
this will display all tables ( names ) starting with analytics_ inside the database sql_tutorial
OR
Using schema and order byWe can display in order of table names by using order by query. We can also include Like command to filter the tables.
This article is written by plus2net.com team.
![]() ![]() |