Getting Started with Snowflake (Query Loaded Data)

397 viewsNative Apps Frameworksnowflakenativeapps
0

Getting Started with Snowflake (Query Loaded Data):

Alejandro Penzini Answered question December 13, 2023
0

You can query the data within the emp_basic table using standard SQL alongside any supported functions and operators. Additionally, standard Data Manipulation Language (DML) commands allow you to perform operations like updating the loaded data or inserting additional data.

Retrieve all data:

Return all rows and columns from the table:

SELECT * FROM emp_basic;

The following is a partial result:

+------------+--------------+---------------------------+-----------------------------+--------------------+------------+
| FIRST_NAME | LAST_NAME | EMAIL | STREETADDRESS | CITY | START_DATE |
|------------+--------------+---------------------------+-----------------------------+--------------------+------------|
| Arlene | Davidovits | adavidovitsk@sf_tuts.com | 7571 New Castle Circle | Meniko | 2017-05-03 |
| Violette | Shermore | vshermorel@sf_tuts.com | 899 Merchant Center | Troitsk | 2017-01-19 |
| Ron | Mattys | rmattysm@sf_tuts.com | 423 Lien Pass | Bayaguana | 2017-11-15 |
...
...
...
| Carson | Bedder | cbedderh@sf_tuts.co.au | 71 Clyde Gallagher Place | Leninskoye | 2017-03-29 |
| Dana | Avory | davoryi@sf_tuts.com | 2 Holy Cross Pass | Wenlin | 2017-05-11 |
| Ronny | Talmadge | rtalmadgej@sf_tuts.co.uk | 588 Chinook Street | Yawata | 2017-06-02 |
+------------+--------------+---------------------------+-----------------------------+--------------------+------------+

Insert additional data rows:

Beyond loading data from staged files into a table, you can insert rows directly into a table using the INSERT Data Manipulation Language (DML) command.

As an illustration, to insert two additional rows into the table:

INSERT INTO emp_basic VALUES
('Clementine','Adamou','cadamou@sf_tuts.com','10510 Sachs Road','Klenak','2017-9-22') ,
('Marlowe','De Anesy','madamouc@sf_tuts.co.uk','36768 Northfield Plaza','Fangshan','2017-1-26');

Query rows based on email address:

Retrieve a list of email addresses containing United Kingdom top-level domains using the LIKE function:

SELECT email FROM emp_basic WHERE email LIKE '%.uk';

The following an example result:

Query rows based on start date:

As an illustration, to determine the potential commencement date for specific employee benefits, add 90 days to the employees' start dates using the DATEADD function. Narrow down the list to include only those employees whose start date precedes January 1, 2017:

SELECT first_name, last_name, DATEADD('day',90,start_date) FROM emp_basic WHERE start_date <= '2017-01-01';

Alejandro Penzini Answered question December 13, 2023

Maximize Your Data Potential With ITS

Feedback on Q&A