- Snowflake Tutorial
- Snowflake - Home
- Snowflake - Introduction
- Snowflake - Data Architecture
- Snowflake - Functional Architecture
- Snowflake - How to Access
- Snowflake - Editions
- Snowflake - Pricing Model
- Snowflake - Objects
- Snowflake - Table and View Types
- Snowflake - Login
- Snowflake - Warehouse
- Snowflake - Database
- Snowflake - Schema
- Snowflake - Table & Columns
- Snowflake - Load Data From Files
- Snowflake - Sample Useful Queries
- Snowflake - Monitor Usage and Storage
- Snowflake - Cache
- Unload Data from Snowflake to Local
- External Data Loading (from AWS S3)
- External Data Unloading (Into AWS S3)
- Snowflake Resources
- Snowflake - Quick Guide
- Snowflake - Useful Resources
- Snowflake - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Snowflake - Database
A database is a logical grouping of schemas where tables and columns resides. In this chapter, we will discuss about how to create a database, and view details.
Snowflake provides the user two ways to create a database, first way is by using user interface and the second way is by applying SQL query.
Working with Databases using Snowflake's UI
All data in Snowflake is maintained in databases. Each database consists of one or more schemas, which are logical groupings of database objects, such as tables and views. Snowflake does not restrict the limits on the number of databases, you can create schemas (within a database), or objects (within a schema).
Creating a Database
Login into Snowflake account using unique URL. Click Databases present at top ribbon as shown in the following screenshot −
It will navigate to the next screen. Click the Create button above the list of databases as shown below.
It will take you to the Create Database dialog box. Enter the Database Name and Comment, then click the Finish button.
Once the database is created, user can view in the list as shown in the following screenshot −
Now for viewing all the created databases, click Databases present at the top ribbon. It displays the View panel of the database where all the created databases are present.
Use the Create button for creating a new warehouse. User can clone a database as well, by selecting a database and clicking Clone as shown in the following screenshot −
It pops up a Clone Database dialog box to enter some information like Name, Source, Comment. After entering those details click Finish button as shown in the following screenshot −
User can see another database is created and it will be visible in view panel. User can also delete a database, by selecting a database and clicking on Drop button as shown in the following screenshot −
It pops up a dialog box for confirmation. Click Yes for deletion, else No.
Working on Databases using Snowflake's SQL Interface
Here, we will learn how to create and view the databases by using the SQL interface of Snowflake.
For creating a database, first you need to Login into Snowflake and navigate to Worksheets. By default, Worksheet is opened once the user logs in, else click the Worksheets icon present at the top ribbon.
Write the following query to create a database "TEST_DB_2"
CREATE DATABASE "TEST_DB_2"
Now click the Run button to execute the query. Result will be displayed in the the Results panel as the TEST_DB_2 database was successfully created. The following screenshot displays the output processed by using SQL −
To view all the listed warehouses, user can use the following SQL. It brings the details of all listed warehouses.
To clone a database, user can use the following SQL, here “TEST_DB_3” is a new database named while DEMO_DB is used to clone it −
CREATE DATABASE TEST_DB_3 CLONE "DEMO_DB"
To delete database, use the following SQL −
DROP DATABASE "TEST_DB_3"
User can run SHOW DATABSE query after each operation to verify whether operation is completed.