Snowpark Migration Accelerator: Distinct¶
Description¶
Select all matching rows from the table references after removing duplicates in results. (Databricks SQL Language Reference SELECT (https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select.html))
DISTINCT
eliminates duplicate values from the result set. (Snowflake SQL Language Reference SELECT)
Syntax¶
SELECT [ DISTINCT ] { named_expression | star_clause } [, ...]
FROM table_reference
SELECT [ DISTINCT ]
{
[{<object_name>|<alias>}.]<col_name>
| [{<object_name>|<alias>}.]$<col_position>
| <expr>
}
[ [ AS ] <col_alias> ]
[ , ... ]
[ ... ]
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;
c |
---|
3 |
1 |
2 |
4 |
Snowflake¶
SELECT DISTINCT c FROM number1;
c |
---|
3 |
1 |
2 |
4 |
Known Issues¶
No issues were found