SQL Show Databases (original) (raw)

Last Updated : 25 Mar, 2026

The SHOW DATABASES command is used to retrieve and display all databases accessible to the current user in a DBMS. It simplifies database management by avoiding direct queries on system tables.

**Syntax:

SHOW DATABASES;

Working with SQL Show Databases

The following examples demonstrate how to use the SHOW DATABASES command in different scenarios, including listing all databases and filtering results using conditions.

Example 1: Listing All Databases

This example shows how to use SHOW DATABASES to view all databases available on the server. It provides a quick overview of existing databases.

**Query:

SHOW DATABASES;

**Output:

Screenshot-2026-03-25-120733

Example 2: Filtering Databases Using LIKE

This example demonstrates filtering databases using the LIKE clause based on a naming pattern. It helps in quickly finding specific databases.

**Query:

SHOW DATABASES WHERE Database LIKE 'my%' ;

**Output:

Screenshot-2026-03-25-121540

Example 3: Filtering Databases Using NOT LIKE

This example shows how to exclude databases using the NOT LIKE condition. It is useful for removing unwanted results from the list.

**Query:

SHOW DATABASES WHERE Database NOT LIKE 'test%' ;

**Output:

Screenshot-2026-03-25-121719