More Related Content Similar to Individual Project ---Yezhou Liang (7) Individual Project ---Yezhou Liang1. Database Design & Management
MASY1-GC 3500
Professor: Marc S. Paller
Individual Project
-------- Yezhou Liang(10/16/16)
2. Ayi Dumplings sells all kinds of dumplings and
beverage online in New Jersey. Dumplings with meat
and vegetable fillings, is very popular during the
Spring Festival and other festivals in China. It tops the
list of delicacies of people in north of China, where
people eat dumplings at midnight on New Year's Eve
and for breakfast on New Year's Day. They have
different flavors, such as chives shrimp dumpling,
cabbage shrimp dumpling, cabbage pork dumpling.
They buy raw material from NY Mart twice a week,
such as organic vegetables, eggs and meat.
3. Business Rule
ß Ayi Dumplings sells all kinds of
dumplings and beverage in New
Jersey and New York. There is
one person who will record
customers’ information via Excel,
such as customer name, gender
and address. They have four full-
time staff for delivery. Their
customers come from three
parts. One part comes from
Wechat users which is most part
of customers. Other customers
use message and email to order
food.
ß There are two storage locations
for this store. One is located in
New Jersey. Another is located in
New York. When customers
make order, they will have their
order ID. The order information
include order date and order
price. Meanwhile, they will get
invoice for their order. The
invoice information includes
invoice ID and invoice date.
8. Create Table
Create Customer Table
CREATE TABLE "LIANGYE"."CUSTOMER_T"
( "CUSTOMERID" NUMBER(*,0) NOT NULL ENABLE,
"CUSTOMERNAME" VARCHAR2(20 BYTE),
"GENDER" VARCHAR2(10 BYTE),
"CUSTOERADDRESS" VARCHAR2(50 BYTE),
CONSTRAINT "CUSTOMER_T_PK" PRIMARY KEY ("CUSTOMERID")
Create Delivery Table
CREATE TABLE "LIANGYE"."DELIVERY"
( "DELIVERYID" NUMBER(*,0) NOT NULL ENABLE,
"STORAGE“ VARCHAR2(10 BYTE),
"STAFF“ VARCHAR2(40 BYTE),
CONSTRAINT "DELIVERY_PK" PRIMARY KEY ("DELIVERYID")
9. Create Table
Create Method Table
CREATE TABLE "LIANGYE"."METHOD"
( "METHODID" NUMBER(*,0) NOT NULL ENABLE,
"DEVICETYPE" VARCHAR2(20 BYTE),
CONSTRAINT "METHOD_PK" PRIMARY KEY ("METHODID")
Create Order Table
CREATE TABLE "LIANGYE"."ORDER_T"
( "ORDERID" NUMBER(*,0) NOT NULL ENABLE,
"ORDEDATE" DATE,
"SALESREVENUE“ VARCHAR2(20 BYTE),
CONSTRAINT "ORDER_T_PK" PRIMARY KEY ("ORDERID")
10. Create Table
Create Product Table
CREATE TABLE "LIANGYE"."PRODUCT_T"
( "PRODUCTID" NUMBER(*,0) NOT NULL ENABLE,
"CATEGORY" VARCHAR2(20 BYTE),
"PRODUCTDESCRIPTION" VARCHAR2(50 BYTE),
CONSTRAINT "PRODUCT_T_PK" PRIMARY KEY ("PRODUCTID")
Create Orderline Table
CREATE TABLE "LIANGYE"."ORDERLINE"
( "ORDERLINEID" NUMBER(*,0) NOT NULL ENABLE,
"QUANTITY" NUMBER(*,0),
CONSTRAINT "ORDERLINE_PK" PRIMARY KEY ("ORDERLINEID")
11. Create Table
Create Invoice Table
CREATE TABLE "LIANGYE"."INVOICE"
( "INVOICEID" NUMBER(*,0) NOT NULL ENABLE,
"INVOICEDATE" DATE,
CONSTRAINT "INVOICE_PK" PRIMARY KEY ("INVOICEID")
12. Store Data
Customer Table
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0001','Cheng Ding','M','110 1ST');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values('0002','Kevin','M','150 Bay St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0003','Lee','M','208 Central Ave');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0005','Lena','F','15 Fox Pl');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0006','Lenore','F','673 Bergen Ave');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0007','Abe','F','61 Erie St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0008','Babb','M','2801 John F Kennedy Blvd');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0009','Camilla','F','213 Sip Ave');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00013','Edith','F','334 Furman St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00014','Elaine','F','130 St Marks Pl');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00015','Gabriel','F','125 E 7th St');
13. INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00016','Haley','F','233 E 4th St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('0004','McGee','F','311 Baldwin Ave')
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00010','Cannon','F','356 Varick St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00011','Carla','F','785 Bergen Ave');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00017','Handy','F','2 Harrison St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00018','Jacqueline','F','260 Bleecker St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00019','Kaley','F','201 Bleecker St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00020','Karen','F','820 Washington St');
INSERT INTO CUSTOMER_T (CustomerID, CustomerName, Gender, CustomerAddress)
Values ('00012','Earl','M','48 Journal Sq');
Customer Table
15. Delivery Table
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0001,'NY','XINTONG’);
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0002','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0003','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0004','NJ','Virgin');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0005','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0006','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0007','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0008','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0009','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('00010','NJ','Virgin');
16. INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('00011','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0012','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0013','NJ','Virgin');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0014','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0015','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0016','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0017','NJ','Virgin');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0018','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0019','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0020','NJ','Virgin');
Delivery Table
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('00011','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0012','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0013','NJ','Virgin');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0014','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0015','NY','XINTONG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0016','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0017','NJ','Virgin');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0018','NY','TIANFENG');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0019','NJ','WEIWEI');
INSERT INTO DELIVERY (DeliveryID, Storage, Staff)
Values ('0020','NJ','Virgin');
Delivery Table
18. INSERT INTO METHOD (MethodID, DeviceType)
Values ('0001','message');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0002','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0003','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0004','email');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0005','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0006','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0007','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('0008','message');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00010','email');
Method Table
19. INSERT INTO METHOD (MethodID, DeviceType)
Values ('00011','email');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00012','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00013','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00014','message');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00015','message');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00016','email');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00017','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00018','wechat');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00019','email');
INSERT INTO METHOD (MethodID, DeviceType)
Values ('00020','message');
Method Table
21. Order Table
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0001','01-1月-15','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0002','12-2月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0003','24-3月-15','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0004','28-3月-15','10');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0005','14-4月-16','10');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0006','02-8月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0007','13-8月-16','12');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0008','16-8月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0009','29-8月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00010','25-9月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0001','01-1月-15','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0002','12-2月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0003','24-3月-15','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0004','28-3月-15','10');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0005','14-4月-16','10');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0006','02-8月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0007','13-8月-16','12');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0008','16-8月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('0009','29-8月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00010','25-9月-16','8');
Order Table
22. Order Table
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00011','27-9月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00012','30-9月-16','12');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00013','1-10月-16','14');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00014','5-10月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00015','7-10月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00016','9-10月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00017','10-10月-16','16');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00018','12-10月-16','8');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00019','14-10月-16','12');
INSERT INTO ORDER_T (OrderID, OrderDate, SalesRevenue)
Values ('00020','15-10月-16','20');
24. Product Table
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0001','dumpling','chives shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0002','dumpling','cabbage shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0003','dumpling','pumpkin shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0004','dumpling','celery shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0005','dumpling','carriot shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0006','dumpling','fennel shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0007','dumpling','corn shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0008','dumpling','fish shrimp');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('0009','beverage','soda');
INSERT INTO PRODUCT_T ( ProductID, Category, Productdescription)
Values ('00010','beverage','cocacola');
26. Orderline Table
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0001','1');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0002','1');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0003','4');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0004','');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0005','3');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0006','2');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0007','3');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0008','1');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('0009','1');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00010','2');
27. Orderline Table
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00011','2');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00012','4');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00013','2');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00014','3');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00015','4');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00016','2');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00017','3');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00018','1');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00019','3');
INSERT INTO ORDERLINE (OrderlineID, Quantity)
Values ('00020','4');
29. INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0001','01-1月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0002','17-2月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0003','19-2月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0004','01-4月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0005','20-4月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0006','26-4月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0007','07-8月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0008','12-8月-16')
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('0009','20-8月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00010','24-8月-16');
Invoice Table
30. INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00011','04-9月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00012','10-9月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00013','16-9月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00014','20-9月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00015','01-10月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00016','04-10月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00017','10-10月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00018','12-10月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00019','13-10月-16');
INSERT INTO INVOICE (InvoiceID, InvoiceDate)
Values ('00020','15-10月-16');
Invoice Table
32. Question 1:
Number of product types stocked in the business?
Query:
SELECT COUNT (*)
FROM PRODUCT_T;
Result:
Use Database to Solve Real Problem
34. Question 3:
What is average value of sales revenue?
Query:
SELECT AVG(SALESREVENUE)
FROM ORDER_T;
Result
35. Question 4:
Which customer who purchased dumplings in
NJ and NY? (Totally, 20 people in database)
Query:
SELECT STORAGE
FROM DELIVERY
WHERE STORAGE IN('NJ');
Result:
36. Question 4:
Which customer who purchased dumplings in NJ
and NY? (Totally, 20 people in database)
Query:
SELECT STORAGE
FROM DELIVERY
WHERE STORAGE IN('NY');
Result:
37. Question 5:
What are they gender?(Totally, 20 customers in customer
table)
Query
SELECT GENDER
FROM CUSTOMER_T
WHERE GENDER='F';
Result:
38. Question 5:
What are they gender?(Totally, 20 customers in
customer table)
Query
SELECT GENDER
FROM CUSTOMER_T
WHERE GENDER=‘M';
Result:
39. Question6:
What are they device for ordering dumplings?
FROM METHOD
WHERE DEVICETYPE='wechat';
Query 1:
Result1 :
FROM METHOD
WHERE DEVICETYPE=‘message';
Query 3
FROM METHOD
WHERE DEVICETYPE=‘email’
Query 2
Result2
Result3
40. Project Report:
The business used in this project is a private catering company which is
newly established in 2016, with headquarter at Jersey City. According to
the questions and answers, we can conclude that it has 10 types of
products stocked in this business. In total, there are 50 products stocked in
business. The average value of sales revenue is about 11 dollars. In this
database containing 20 people, there are 10 living in NJ and 10 in NY. At the
same time, there are 15 female customers and 5 male customers. We can
see that 75% of customers are women. It means that women prefer
dumplings than men.
In the database of method, there are
different numbers of people using
three kinds of method – wechat,
message, email. There are nearly half
people using wechat, because wechat is
the most famous social app in Chinese,
and most customer in this business
come from China.
41. Project Report:
During the interview with the boss of this company, she told us that the
sales volume of this company had increased from about 100 dollars per
day to 600 dollars per day in the last 6 months. At the beginning, they
used Excel to record order without any professional database tools. But
recently, they are trying to using the MySQL and PostgreSQL. With the
business growing, the company wants to gradually transfer the DBMS
platform to Oracle to ensure the database can support the growing daily
operational data. For this project, an important goal is to verify the
possibility of using database and show the great advantage of SQL
developer. Of course, database will help them to analyze their data more
easily.