SQL ALL
CREATE TABLE cardpoints ( id INTEGER NOT NULL, pointedlocation CHAR(32) NOT NULL, point INTEGER NOT NULL CONSTRAINT points_point_range CHECK(point BETWEEN 0 AND 15000), PRIMARY KEY(id, pointedlocation) ); INSERT INTO cardpoints (id, pointedlocation, point) VALUES (1, 'convinience store', 10); INSERT INTO cardpoints (id, pointedlocation, point) VALUES (1, 'super market', 20); INSERT INTO cardpoints (id, pointedlocation, point) VALUES (2, 'convinience store', 15); -- ============================== SELECT * FROM card points; id | pointedlocation | point ----+----------------------------------+------- 1 | convinience store | 10 1 | super market | 20 2 | convinience store | 15 (3 rows) SELECT * FROM cardpoints WHERE 10 < ALL(SELECT point FROM cardpoints); id | pointedlocation | point ----+-----------------+------- (0 rows) SELECT * FROM cardpoints WHERE 10 <= ALL(SELECT point FROM card points); id | pointedlocation | point ----+----------------------------------+------- 1 | convinience store | 10 1 | super market | 20 2 | convinience store | 15 (3 rows)
PostgreSQL: Documentation: 9.4: Subquery Expressions
SQL-92 だと仕様記載は何処だろうか(ざっと見検討つかず)