Snowpark Migration Accelerator: Distinct¶
描述¶
从参考的表中选择所有唯一行。(Databricks SQL 语言参考 SELECT (https://docs.databricks.com/en/sql/language-manual/sql-ref-syntax-qry-select.html))
DISTINCT
会从查询结果中移除重复行。(Snowflake SQL 语言参考 SELECT)
语法¶
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> ]
[ , ... ]
[ ... ]
示例源模式¶
设置数据¶
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);
模式代码¶
Databricks¶
SELECT DISTINCT c FROM number1;
c |
---|
3 |
1 |
2 |
4 |
Snowflake¶
SELECT DISTINCT c FROM number1;
c |
---|
3 |
1 |
2 |
4 |
已知问题¶
未发现任何问题