Nhập môn Mô hình dữ liệu trong 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: Mệnh đề SQL truy xuất dữ liệu từ một thực thểDISTINCT: Trả về giá trị duy nhất của một thuộc tínhCOUNT: Đếm số hàng thỏa điều kiệnGROUP BY: Gom các hàng theo giá trị của thuộc tính chỉ địnhHAVING: Dùng với GROUP BY để lọc nhóm theo điều kiệnWHERE: Lọc bản ghi theo điều kiệnAS: Đặt bí danh cho cột hoặc bảng-- 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;
Nhập môn Mô hình dữ liệu trong Snowflake