SQL Basics In Snowflake - Part 1

What is SQL?

SQL stands for Structured Query Language and lets you access and manipulate databases.

How to SQL:

The order below is the structure you need to follow when writing SQL in Snowflake. Its similar to the flows of Alteryx (e.g. Input tool, Filter tool, select tool, summarize)

To bring tables into view from snowflake:

  • SELECT  * - bring in all the data
  • FROM "...." - which data file we are bringing in
  • Use double quotes when specifying a column header/name & single for values in the rows
The results table will have the dataset you are bringing in from said line of code
  • SELECT DISTINICT "...." - Only the Column specified will show in the dataset [can have multiple columns specified = SELECT DISTINCT "...", "...", "..."]
Only the column you have specified will show up in the results table 

Preview datasets to make life a little bit easier:

You can also preview data from any dataset - this is a good idea if you are trying to transform a dataset and you want to compare it to the original dataset.

In this case, it would be a good idea to have the original dataset as a preview dataset. So when you make changes and want to compare, you can easily switch between the results window and the data preview window.

Some Code for SQL:

Answering questions using SQL:

Author:
Maha Hussari
Powered by The Information Lab
1st Floor, 25 Watling Street, London, EC4M 9BR
Subscribe
to our Newsletter
Get the lastest news about The Data School and application tips
Subscribe now
© 2024 The Information Lab