Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CREATE DATABASE IF NOT EXISTS RetailDB; USE RetailDB; DROP TABLE IF EXISTS Contain; DROP TABLE IF EXISTS OrdersPlaces; DROP TABLE IF EXISTS Items; DROP TABLE
CREATE DATABASE IF NOT EXISTS RetailDB;
USE RetailDB;
DROP TABLE IF EXISTS Contain;
DROP TABLE IF EXISTS OrdersPlaces;
DROP TABLE IF EXISTS Items;
DROP TABLE IF EXISTS Phones;
DROP TABLE IF EXISTS Customers;
CREATE TABLE Customers
custid CHAR
fName VARCHAR
lName VARCHAR
password VARCHAR
PRIMARY KEYcustid;
CREATE TABLE Phones
custid CHAR
phone CHAR
PRIMARY KEYcustidphone
FOREIGN KEYcustid REFERENCES Customerscustid;
CREATE TABLE Items
iID CHAR
name VARCHAR
price DECIMAL #its maximum value is
qtyInStock SMALLINT,
PRIMARY KEY iID;
CREATE TABLE OrdersPlaces
oID CHAR
ordDate DATE,
shippingDate DATE,
receivalDate DATE,
payAmount DECIMAL #its maximum value is
payMethod VARCHAR
custid CHAR NOT NULL,
PRIMARY KEY oID
FOREIGN KEYcustid REFERENCES Customerscustid;
CREATE TABLE Contain
oID CHAR
iID CHAR
price DECIMAL
qty SMALLINT,
PRIMARY KEY oIDiID
FOREIGN KEYoID REFERENCES OrdersPlacesoID
FOREIGN KEYiID REFERENCES ItemsiID;
answer tasks using these tables
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started