Distinct

Distinction is critical if you want to stand out from the crowd

Description

Select all matching rows from the table references after removing duplicates in results. (Databricks SQL Language Reference SELECT)

DISTINCT eliminates duplicate values from the result set. (Snowflake SQL Language Reference SELECT)

Syntax

SELECT [ DISTINCT ] { named_expression | star_clause } [, ...]
  FROM table_reference

Sample Source Patterns

Setup data

Databricks

CREATE TEMPORARY VIEW number1(c) AS VALUES (3), (1), (2), (2), (3), (4);

Snowflake

CREATE TEMPORARY TABLE number1(c int);
INSERT INTO number1 VALUES (3), (1), (2), (2), (3), (4);

Pattern code

Databricks

SELECT DISTINCT c FROM number1;

Snowflake

SELECT DISTINCT c FROM number1;

Known Issues

No issues were found

No related EWIs

Last updated