# E051-04: GROUP BY can contain columns not in <select list>

statement ok
CREATE TABLE TABLE_E051_04_01_01 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT ALL B FROM TABLE_E051_04_01_01 GROUP BY B

statement ok
CREATE TABLE TABLE_E051_04_01_02 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT ALL B FROM TABLE_E051_04_01_02 WHERE A = 1 GROUP BY B

statement ok
CREATE TABLE TABLE_E051_04_01_03 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT B FROM TABLE_E051_04_01_03 GROUP BY B

statement ok
CREATE TABLE TABLE_E051_04_01_04 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT B FROM TABLE_E051_04_01_04 WHERE A = 1 GROUP BY B

statement ok
CREATE TABLE TABLE_E051_04_01_05 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT DISTINCT B FROM TABLE_E051_04_01_05 GROUP BY B

statement ok
CREATE TABLE TABLE_E051_04_01_06 ( ID INT PRIMARY KEY, A INT, B INT );

query I
SELECT DISTINCT B FROM TABLE_E051_04_01_06 WHERE A = 1 GROUP BY B
