SQL antipatterns:  SELECT DISTINCT

Uli Bethke August 9, 2022

The DISTINCT operator The DISTINCT operator is used to eliminate duplicates in a resultset, e.g. we can use it to identify the unique number of customers who made a purchase. We run the following query against the Sample Data provided with Snowflake data cloud platform. SELECT DISTINCT SS_CUSTOMER_SK from "SAMPLE_DATA"."TPCDS_SF10TCL"."STORE_SALES"; 1 SELECT DISTINCT SS_CUSTOMER_SK from ...

Read More