############################################################################################## ## Brian Platz ## ## CS85 Section 1643 ## ## Professor Geddes ## ## May 12, 2012 ## ## Assignment: Test 3, Part C ## ## ## ## Part C: ## ## write a SQL script called cars.sql.txt that creates a cars table in the test3 database, ## ## populates it with the data given above for the three cars, and retrieves all the data, ## ## displaying it in ascending order by driver. ## ## Jeannie drives an absolute red 2007 Toyota Solara. ## ## Bill drives a burnt orange 1966 Chevrolet Corvette. ## ## Ken drives a pearl essence green 1966 Jaguar XKE. ## ## Note: You only have to write the script; you do NOT have to run it. ## ############################################################################################## CREATE DATABASE IF NOT EXIST test3; USE test3; CREATE TABLE cars( pseudoVIN INT NOT NULL AUTO_INCREMENT, color VARCHAR(20), year INT, make VARCHAR(10), model VARCHAR(10), driver VARCHAR(10), PRIMARY KEY (pseudoVIN) ); INSERT INTO cars VALUES( null, 'absolute red', 2007, 'Toyota', 'Solara', 'Jeannie'); INSERT INTO cars VALUES( null, 'burnt orange', 1966, 'Chevrolet', 'Corvette', 'Bill'); INSERT INTO cars VALUES( null, 'pearl essence green', 1966, 'Jaguar', 'XKE', 'Ken'); SELECT * FROM cars ORDER BY driver ASC; ## NOTE: can omit 'ASC' above. Will do so by default.