ungroupedaggregatesnegative.sql
来自「derby database source code.good for you.」· SQL 代码 · 共 26 行
SQL
26 行
-- negative tests for ungrouped aggregates-- create a tablecreate table t1 (c1 int);create table t2 (c1 int);insert into t2 values 1,2,3;-- mix aggregate and non-aggregate expressions in the select listselect c1, max(c1) from t1;select c1 * max(c1) from t1;-- aggregate in where clauseselect c1 from t1 where max(c1) = 1;-- aggregate in ON clause of inner joinselect * from t1 join t1 as t2 on avg(t2.c1) > 10;-- correlated subquery in select listselect max(c1), (select t2.c1 from t2 where t1.c1 = t2.c1) from t1;-- noncorrelated subquery that returns more than 1 rowselect max(c1), (select t2.c1 from t2) from t1;-- drop the tabledrop table t1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?