
CREATE TABLE S (
	SNO	CHAR(2),
	SNAME	VARCHAR(8),
	STATUS	INTEGER,
	CITY	VARCHAR(8));
COPY S FROM 'book_s.table';

CREATE TABLE P (
	PNO	CHAR(2),
	PNAME	VARCHAR(8),
	COLOR	VARCHAR(8),
	WEIGHT	INTEGER,
	CITY	VARCHAR(8));
COPY P FROM 'book_p.table';

CREATE TABLE SP (
	SNO	CHAR(2),
	PNO	CHAR(2),
	QTY	INTEGER);
COPY SP FROM 'book_sp.table';

CREATE TABLE ONE (
	A INTEGER,
	B INTEGER,
	C INTEGER);
INSERT INTO ONE VALUES (3,4,NULL);


-- chapter 16 page 239
SELECT A > B AND B > C AS xx FROM ONE;
SELECT A > B OR  B > C AS xx FROM ONE;
SELECT A < B OR  B < C AS xx FROM ONE;
SELECT NOT (A=C) AS xx FROM ONE;

-- page 241
SELECT (1,2,NULL) = (3,NULL,4) AS xx FROM ONE;
SELECT (1,2,NULL) < (3,NULL,4) AS xx FROM ONE;
SELECT (1,2,NULL) = (1,NULL,4) AS xx FROM ONE;
SELECT (1,2,NULL) > (NULL,2,4) AS xx FROM ONE;

SELECT S.SNO FROM S
WHERE S.CITY <> (SELECT S.CITY FROM S WHERE S.SNO='S6');

-- page 242
SELECT C IS NULL AS xx FROM ONE;
SELECT A IS NULL AS xx FROM ONE;
SELECT B IS NOT NULL AS xx FROM ONE;


DROP TABLE S;
DROP TABLE P;
DROP TABLE SP;
DROP TABLE ONE;
