To complete this tutorial, you’ll need to have a snowflake account and the URL to login to the web user interface. Start by navigating to your URL and login.

Creating Databases with the User Interface

Login to your Snowflake environment and select the Databases tab in the top left of your screen. It should look similar to the image below except you won’t have the same databases. Snowflake provides some sample data for you.

Let’s create a new database. Click the Create button and fill out the information in the pop up window.

When naming the database, there are restrictions — no spaces and the name cannot start the name with a number. You can read the full set of restrictions in Snowflake’s documentation.

Select Finish and you’ll see your new database appear in the table. Click on your database and you’ll see any tables, views or schemas that exist. Since the database has just been created, none of these objects exists yet.

Creating Schemas

A snowflake schema is a logical grouping of database objects (tables, views, etc.). Each schema belongs to a single database and can have its own security configuration.

From inside our selected database, select the Schemas tab. Snowflake will create a public and information schema by default. The PUBLIC schema can be used to create any other objects. The INFORMATION_SCHEMA contains all the metadata for the database.

Click the create button and provide and name and comment. The Managed Access option determines if the security of the objects within the schema is managed by the schema owner or owner of the object.

Creating Databases and Schemas with Code

All operations done with the UI can also be done with SQL code on the worksheets tab. To see what code corresponds to the operations we are doing, click on the Show SQL button.

Using code makes our job easier once we have a grasp of how Snowflake works. This can cut down on time and be automated.

To execute any SQL code in Snowflake, select Worksheets from the main navigation bar. This area lists all databases on the left side for reference and provides a place for you to enter your code. On the right, we can see our current role, database, warehouse and schema.

Let’s enter the code required to replicate the process we did before with the UI. When you click the Run button, only the command where your cursor lies will execute. To execute multiple lines, highlight them and click run. If you have already created your database, you’ll need to run DROP DATABASE DEMO_DB for this to work.