-- file: bookCreate.sql

-- usage: from psql, do
--
--	=> \i bookCreate.sql
--
--	This will
--	(1) create a Books relation,
--	(2) insert some tuples
--	(3) update a tuples
--	(4) selects some tuples


-- STEP (1) 
CREATE TABLE Books (
	Title VARCHAR(20),
	Price MONEY);

-- STEP (2) 
INSERT INTO Books 
	VALUES ('Intro Java', '$20.99');
INSERT INTO Books 
	VALUES ('Database Systems', '$40.00');
INSERT INTO Books 
	VALUES ('Networking', '$51.00');


-- STEP (3) 
SELECT Title FROM Books;


SELECT * FROM Books
	WHERE Price > '$35.00';

-- STEP (4) 
UPDATE Books 
	SET Price = Price - '$1.00'
	WHERE Title != 'Intro Java';

-- STEP (5) 
-- If desired, you can also do:
-- DROP TABLE Books;
	
