Introduction to Data Modeling in Snowflake
Nuno Rocha
Director of Engineering







SELECT manufacturer_id,
manufacturer_name,
location,
COUNT(*) AS repetitions
FROM allproducts
GROUP BY manufacturer_id,
manufacturer_name,
location
HAVING COUNT(*) > 1;

SELECT DISTINCT category
FROM allproducts;

SELECT DISTINCT product_name,
category
FROM allproducts
WHERE category = 'L';

SELECT DISTINCT product_name,
category
FROM allproducts
WHERE category = 'L';

SELECT FROM: SQL clause to retrieve data from a specific entityDISTINCT: SQL clause to return unique (different) values from an attributeCOUNT: SQL clause that counts the number of rows that match the specified criteriaGROUP BY: SQL clause that groups rows with the same values by the specified attributesHAVING: SQL clause used with GROUP BY to filter groups based on a conditionWHERE: SQL clause to filter records based on a set conditionAS: SQL clause used to rename a column or table with an alias-- Querying unique values while being filtered by a specific condition
SELECT DISTINCT column_name
FROM table_name
WHERE column_name condition value;
-- Counting the values aggregated by a specific column while filtering the results
SELECT column_name,
COUNT(*) AS alias_name
FROM table_name
GROUP BY column_name
HAVING COUNT(*) condition value;
Introduction to Data Modeling in Snowflake