Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

* * * * Answer these 5 task using these tables * * * * * * CREATE DATABASE IF NOT EXISTS RetailDB; USE RetailDB;

****Answer these 5 task using these tables******
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(9),
fName VARCHAR(20),
lName VARCHAR(20),
password VARCHAR(40),
PRIMARY KEY(custid));
CREATE TABLE Phones(
custid CHAR(9),
phone CHAR(12),
PRIMARY KEY(custid,phone),
FOREIGN KEY(custid) REFERENCES Customers(custid));
CREATE TABLE Items(
iID CHAR(5),
name VARCHAR(40),
price DECIMAL(6,2), #its maximum value is 9,999.99
qtyInStock SMALLINT,
PRIMARY KEY (iID));
CREATE TABLE OrdersPlaces(
oID CHAR(8),
ordDate DATE,
shippingDate DATE,
receivalDate DATE,
payAmount DECIMAL(8,2), #its maximum value is 999,999.99
payMethod VARCHAR(20),
custid CHAR(9) NOT NULL,
PRIMARY KEY (oID),
FOREIGN KEY(custid) REFERENCES Customers(custid));
CREATE TABLE Contain(
oID CHAR(8),
iID CHAR(5),
price DECIMAL(6,2),
qty SMALLINT,
PRIMARY KEY (oID,iID),
FOREIGN KEY(oID) REFERENCES OrdersPlaces(oID),
FOREIGN KEY(iID) REFERENCES Items(iID));
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions