In a Database Management System (DBMS), a database server may contain multiple databases. Each database stores related tables, views, procedures, and other objects. Before working with any database, it is often necessary to see which databases exist on the server.
The SHOW DATABASES; query is a Data Definition Language (DDL) utility command used in MySQL and similar DBMS systems to display a list of all databases available on the server.
This command helps database administrators and users quickly identify the databases they can access.
The SHOW DATABASES; query is used to display the list of all databases present in the database server.
It retrieves database names from the system catalog and shows them in tabular form.
SHOW DATABASES;
When this query is executed:
The user will only see databases for which they have permission.
SHOW DATABASES;
| Database |
|---|
| information_schema |
| mysql |
| performance_schema |
| sys |
| student_db |
| library_db |
In this example:
The SHOW DATABASES; command is commonly used in the following situations:
Checking available databases
Database administration
System exploration
SHOW DATABASES with ConditionsIn MySQL, you can filter databases using the LIKE clause.
SHOW DATABASES LIKE 'pattern';
SHOW DATABASES LIKE 'student%';
This command will display only databases whose names start with student.
Example Output:
| Database |
|---|
| student_db |
| student_records |
SHOW DATABASES; is mainly used in MySQL.The SHOW DATABASES; query is a simple yet essential command in DBMS. It allows users and administrators to view all available databases on the server. By using this command, users can quickly identify the database they need before selecting it with the USE database_name; statement.