Question: create a relational schema and a er diagram with this information cart table: cart_id int unsigned primary key customer_id int unsigned foreign key cart_items table:

create a relational schema and a er diagram with this information


cart table:

cart_id int unsigned primary key
customer_id int unsigned foreign key

cart_items table:

cart_item_id int unsigned primary key
cart_id int unsigned foreign key
product_id int unsigned foreign key
quantity int unsigned


categories table:

category_id int unsigned primary key
name varchar(255)

customer table:

customer_id int unsigned primary key
first_name varchar(255)
last_name varchar(255)
email varchar(255) (unique)
password varchar(255)
account_number int unsigned
address varchar(255)
state enum('AL','AK','AZ','AR','CA','CO', ...)
zip_code int unsigned
phone varchar(255)

inventory table:

inventory_id int unsigned primary key
product_id int unsigned foreign key
store_id int unsigned foreign key
quantity int unsigned

order_items table:

order_item_id int unsigned primary key
order_id int unsigned foreign key
product_id int unsigned foreign key
quantity int unsigned
price decimal unsigned

orders table:

order_id int unsigned primary key
customer_id int unsigned foreign key
store_id int unsigned foreign key
order_date datetime
tracking_number int unsigned
delivery_date datetime
status enum('Pending','Processing','Shipped','Delivered','Cancelled','Returned')

po_items table:

po_item_id int unsigned primary key
po_id int unsigned foreign key
product_id int unsigned foreign key
quantity int unsigned
price decimal unsigned

products table:

product_id int unsigned primary key
name varchar(255)
description varchar(255)
thumbnail_path varchar(255)
price double
category_id int unsigned foreign key
brand varchar(65)
featured bit(1)

purchase_orders table:

po_id int unsigned primary key
store_id int unsigned foreign key
order_date datetime
tracking_number int unsigned
status enum('Pending','Processing','Shipped','Delivered','Cancelled')
delivery_date datetime
received bit(1)

stores table:

store_id int unsigned primary
name varchar(255)
address varchar(255)
city varchar(255)
state enum('AL','AK','AZ','AR','CA','CO', ...)
zip_code int unsigned
phone varchar(255)

Step by Step Solution

3.51 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

CREATE TABLE cart cartid INT UNSIGNED NOT NULL PRIMARY KEY customerid INT UNSIGNED NOT NULL FOREIGN KEY REFERENCES customerscustomerid CREATE TABLE ca... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!