## Brian Platz ## CS85 Section 1643 ## Professor Geddes ## May 5, 2012 ## Assignment: ## Write the SQL DDL statements to create the database and the tables. ## When writing several SQL statements, it is usually convenient to save them in a SQL script file. ## That way you can easily run them again without having to retype the statements. ## Save your statements in a file called premiereCreate.sql.txt. ## You can run your SQL script file in MySQL using the source command. ## salesrep(salesID, lname, fname, address, comtot, comrate) ## customer(custID, name, address, balance, climit, salesRep) ## inventory(partID, itemDesc, count, class, whouse, cost) ## custOrder(orderID, oDate, customer) ## orderitem(order, lineID, part, quant, quote) DROP DATABASE IF EXISTS premiere; CREATE DATABASE premiere; USE premiere; CREATE TABLE salesrep( salesID int PRIMARY KEY, lname varchar(15), fname varchar(15), address varchar(25), comtot float(2), comrate float(2) ); CREATE TABLE customer( custID int PRIMARY KEY, name varchar(31), address varchar(20), balance float(2), climit float(2), salesRep int); CREATE TABLE inventory( partID int PRIMARY KEY, itemDesc varchar(20), count int, class char(2), whouse int, cost float(2) ); CREATE TABLE custOrder( orderID int PRIMARY KEY, oDate date, customer int); CREATE TABLE orderitem( orderNo int, lineID int PRIMARY KEY, part int, quant int, quote float(2) );