This video introduces the fundamentals of using worksheets in the Snowflake
web interface to execute queries and perform other DML and DDL operations.
It also covers some basic database concepts.
Databases are logical containers for organizing your data into schemas and tables.
Because there are logical contracts you can query across multiple databases in
a single query as long as you have the necessary access privileges.
The database's page displays information about the
databases you have created or privileges to access.
To view and perform tasks on the objects in a database, click on the database name.
If your role has the necessary privileges,
you can create and manage objects in the database such as schemas, tables, and views.
Try creating a database and table to see how quick and easy it is.
Note that the public schema was created automatically and
the table was created in this schema by default.
All of these tasks can also be performed using standard sequel DDL commands.
One powerful feature of Snowflake is zero copy cloning of databases, schemas, and tables.
A zero copy clone only uses additional storage if
you change or add data in either the cloned object or the source object.
For more information about cloning and other database
operations see the Snowflake documentation.
This video demonstrates querying tables
in the Snowflake sample data database shared by Snowflake.
If you don't see the database in the databases page it hasn't been enabled for your account,
to have it enabled please contact Snowflake support.
The sample database is read-only, you cannot make changes to the database or any of its tables,
but you can query its tables just as you would any other database.
The database contains multiple sample data sets each stored in a separate schema.
Next we'll use a worksheet to run some queries against the sample database.
To create a worksheet simply click the plus sign.
Worksheets provide a powerful environment for building and executing queries.
They can also be used to perform all other sequel operations,
except for loading data which worksheets do not support.
Bulk data loading will be covered in a later video.
You can create as many worksheets as you need, with up to 50 open at one time.
When you create a worksheet, Snowflake initiates a separate session for the worksheet and uses your
current role as the default for the session.
If you've been assigned multiple roles you can
set your role within a worksheet independently from the web interface and other worksheets.
This is an important concept to understand because the role you set determines the
objects you can access and therefore the operations you can perform in the worksheet.
You can change roles in a worksheet at any time without losing your work.
For more information about your roles and access control, see the Snowflake documentation.
Each worksheet also has a warehouse database and schema.
Together with a role, they specify the context used for all sequel executed in the worksheet.
Use the drop-down menu to set the context.
Alternatively, you can execute use commands in the worksheet to specify this information,
or you can reference the fully qualified names of tables or views directly in your sequel.
Remember most queries in DML operations in Snowflake including inserting and
updating table rows, require running virtual warehouse which consume Snowflake credits.
The worksheet displays information about each
query you execute including the ID and status along with the result.
You can also view the history of queries executed in the current worksheet session.
All changes you make in the worksheet are saved periodically to ensure you don't lose any work.
To rename a worksheet simply select the current name and type the new name.
Some other useful worksheet features are the object browser for viewing the databases,
schemas, tables, and views you can access.
In data preview which lets you view the first
100 rows of data from any table or view in the object browser.
Now let's take a look at the tutorials provided by Snowflake.
The tutorials are self-contained fully annotated sequel scripts
that query the datasets in the sample database.
To run a tutorial, click the arrow and open tutorials, then select a tutorial.
The interface creates a worksheet and loads the contents of the tutorial.
Tutorial 2 uses the open weather map sample data set, which contains public weather data, stored
in JSON format so you can try out Snowflake's high-performance semi structured functionality.
It also demonstrates creating a user-defined function.
Note that the same menu lets you open and manage all your
saved worksheets and also load sequel scripts.
First select a virtual warehouse for processing the queries.
Next execute the commands in the tutorial either individually or all together.
Note that the commands in the tutorial use fully qualified names.
If you wish, you can make changes to
the tutorial script and keep the changes as a "saves" worksheet.
The worksheet only shows results for its own session.
To see a complete list of all queries you executed in the last 14 days across
all worksheets and sessions, click on history.
You can filter the history using the provided filters.
To view the details of a query click the link in the query ID column.
To learn more about the performance and the behavior of a query click
the profile tab in the query details page.
The query profile displays a graphical representation of the processing steps
for the query, including the execution time for each step and how the time was spent.
This concludes the short introduction to worksheets and querying.
For more information see the other videos in this series or
the Snowflake documentation.
Thanks for watching.