Introductie tot datamodellering 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-clausule om data uit een entiteit op te halenDISTINCT: Geeft unieke waarden van een attribuut terugCOUNT: Telt rijen die aan de criteria voldoenGROUP BY: Groepeert rijen met gelijke waarden op opgegeven attributenHAVING: Filtert groepen na GROUP BY op een voorwaardeWHERE: Filtert records op een voorwaardeAS: Geeft een alias aan een kolom of tabel-- Unieke waarden opvragen met een specifieke filtervoorwaarde
SELECT DISTINCT column_name
FROM table_name
WHERE column_name condition value;
-- Aantallen tellen per kolom en resultaten filteren
SELECT column_name,
COUNT(*) AS alias_name
FROM table_name
GROUP BY column_name
HAVING COUNT(*) condition value;
Introductie tot datamodellering in Snowflake