Snowflake Syntax: SHOW DATABASES

·

2 min read

Snowflake Syntax:  SHOW DATABASES

Show Databases:

What does it do?

Used to find:

  • Which Databases are accessible to the current Role
  • create database

  • show schemas

  • show tables

SHOW DATABASES

Lists all the databases for which the Current User has at least USAGE privilege.

show databases;

Output of Snowflake SHOW DATABASES

The screenshot above lists the databases available to the current user.

Quick Tip - Filtering Output

You can filter the output of any SHOW command by re-querying the results using the table function result_scan(). The SQL query below shows databases order by the name column

select *
from table(result_scan(last_query_id()))
order by "name";

Output of Snowflake SHOW DATABASES

💡
Note: When referring to output from any Snowflake command (eg. SHOW) you must include the column name in double quotes exactly as shown in the column header.

Want to learn more from a Snowflake Expert? Click on the image below for training from Analytics Today.

Snowflake Training from Analytics Today


SHOW DATABASES LIKE 'A%'

Lists the accessible databases filtered by the search string.

show databases like 'A%';

Output of Snowflake SHOW DATABASES

The screenshot above shows the output when filtered by names starting with 'A%'

SHOW DATABASES HISTORY

It shows accessible databases, including those dropped but still within the data retention period.

show databases history;

Output of Snowflake SHOW DATABASES HISTORY

The screenshot above shows the AIRBNB database was dropped, but it's within the Retention Time and can be un-dropped.

Further Information

Snowflake Documentation

Show Databases


Snowflake Training from an Snowflake Superhero.

Click on the image below for more information.

Analytics Today Snowflake Training