Skip to main content

Snowflake Syntax: SHOW DATABASES

Updated 2 min readMarkdown
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.

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



About the author

  • After 30 years of experience building multi-terabyte data warehouse systems, I spent five years at Snowflake as a Senior Solution Architect, helping customers across Europe and the Middle East deliver lightning-fast insights from their data.

    In 2023, he joined Altimate.AI, which uses generative artificial intelligence to provide Snowflake performance and cost optimization insights and maximize customer return on investment.

    Certifications include Snowflake Data Superhero, Snowflake Subject Matter Expert, SnowPro Core, and SnowPro Advanced Architect.

No comments yet. Be the first to comment.

More from this blog