更新时间:2024-12-10 GMT+08:00
WITH AS
WITH AS 在GaussDB(DWS)中用于声明一个或多个可以在主查询中通过名字引用的子查询,相当于临时表。DSC工具支持该关键字,迁移工程中保留。
输入示例
1 2 3 4 5 6 7 8 9 10 |
WITH e AS ( SELECT city, sum(population) FROM t1 group by city ), d AS ( SELECT max(music) as max_music, min(music) as min_music from student ), s AS ( SELECT * FROM subject ) SELECT * FROM e; |
输出示例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
WITH e AS ( SELECT city, sum(population) FROM t1 GROUP BY city ), d AS ( SELECT max(music) AS "max_music", min(music) AS "min_music" FROM student ), s AS ( SELECT * FROM subject ) SELECT * FROM e; |
父主题: 表(可选参数、操作)