DROP TABLE CUSTOMER CASCADE CONSTRAINTS;
CREATE TABLE CUSTOMER
(CustomerID INTEGER PRIMARY KEY,
Username VARCHAR2(50),
CustLastName VARCHAR2(25),
CustFirstName VARCHAR2(25),
TotalPurchases NUMBER(8,2),
CustEmailAddress VARCHAR2(50),
CustPhoneNumber CHAR(12),
CustStreetAddress VARCHAR2(30),
CustCity VARCHAR2(25),
CustState VARCHAR2(2),
CustZipCode INTEGER);
DROP TABLE EMPLOYEE CASCADE CONSTRAINTS;
CREATE TABLE EMPLOYEE
(EmployeeID INTEGER PRIMARY KEY,
EmpLastName VARCHAR2(25),
EmpFirstName VARCHAR2(25),
JobTitle VARCHAR2(40),
Salary NUMBER(8,2),
EmployeeSince DATE,
EmpPhoneNumber CHAR(12),
EmpStreetAddress VARCHAR2(30),
EmpCity VARCHAR2(25),
EmpState VARCHAR2(2),
EmpZipCode INTEGER);
DROP TABLE BRAND CASCADE CONSTRAINTS;
CREATE TABLE BRAND
(BrandID INTEGER PRIMARY KEY,
BrandName VARCHAR2(50),
BrandRepLastName VARCHAR(25),
BrandRepFirstName VARCHAR(25),
BrandRepPhoneNumber CHAR(12),
BrandRepEmail VARCHAR2(50));
DROP TABLE DEPARTMENT CASCADE CONSTRAINTS;
CREATE TABLE DEPARTMENT
(DepartmentID INTEGER PRIMARY KEY,
DepartmentName VARCHAR2(25),
DeptMgrLastName VARCHAR2(25),
DeptMgrFirstName VARCHAR2(25),
DeptMgrEmail VARCHAR2(50),
DeptPhoneNumber CHAR(12));
DROP TABLE PRODUCT CASCADE CONSTRAINTS;
CREATE TABLE PRODUCT
(ProductID INTEGER PRIMARY KEY,
BrandID INTEGER REFERENCES BRAND,
ProductDescription VARCHAR2(100),
ProductSize VARCHAR2(2),
Color VARCHAR2(20),
DiscountPercent INTEGER,
Price NUMBER(8,2),
Category VARCHAR2(25));
DROP TABLE CUSTORDER CASCADE CONSTRAINTS;
CREATE TABLE CUSTORDER
(OrderID INTEGER PRIMARY KEY,
CustomerID INTEGER REFERENCES CUSTOMER,
EmployeeID INTEGER REFERENCES EMPLOYEE,
PaymentType VARCHAR2(50),
PaymentAccountNum INTEGER,
PaymentAmount NUMBER(8,2),
OrderTime TIMESTAMP);
DROP TABLE CUSTORDERLINE CASCADE CONSTRAINTS;
CREATE TABLE CUSTORDERLINE
(OrderID INTEGER REFERENCES CUSTORDER,
ProductID INTEGER REFERENCES PRODUCT,
OrderLineQty INTEGER,
constraint CUSTORDERLINE_pk primary key (OrderID,ProductID));
DROP TABLE SHIPPER CASCADE CONSTRAINTS;
CREATE TABLE SHIPPER
(ShipperID INTEGER PRIMARY KEY,
ShipperCompanyName VARCHAR2(50),
ShipperRepLastName VARCHAR2(25),
ShipperRepFirstName VARCHAR2(25),
ShipperPhoneNumber CHAR(12),
ShipperStreet VARCHAR2(30),
ShipperCity VARCHAR2(25),
ShipperState VARCHAR2(2),
ShipperZipCode INTEGER);
DROP TABLE SHIPMENT CASCADE CONSTRAINTS;
CREATE TABLE SHIPMENT
(ShipmentID INTEGER PRIMARY KEY,
ShipperID REFERENCES SHIPPER,
ShipmentCost NUMBER(6,2));
DROP TABLE ORDERLINEQTY CASCADE CONSTRAINTS;
CREATE TABLE ORDERLINEQTY
(ShipmentID INTEGER REFERENCES SHIPMENT,
ProductID INTEGER REFERENCES PRODUCT,
ShipmentQty INTEGER,
constraint ORDERLINEQTY_pk primary key (ShipmentID,ProductID));