Activity No. 1 - SQL Command
Activity No. 1 - SQL Command
Activity No. 1 - SQL Command
DESCRIPTION:
Tables:
Customer
*CustomerID int(11) PRIMARY KEY, AUTO
INCREMENT
*LastName varchar(75) not null
*FirstName varchar(75) not null
*Contact varchar(25) not null
*Address varchar(75) not null
Menu
*MenuID int(11) PRIMARY KEY, AUTO
INCREMENT
*MenuName varchar(75) not null
*CategoryID int(11) FK
*Price double not null
Category
*CategoryID int(11) PRIMARY KEY, AUTO
INCREMENT
*CategoryName varchar(75) not null
Orders
*OrderID int(11) PRIMARY KEY, AUTO
INCREMENT
*CustomerID int(11) FK
DateOrdered date
OrderDetail
OrderDetailID int(11) PRIMARY KEY, AUTO
INCREMENT
OrderID int(11) FK
MenuID int(11) FK
Quantity int(11)
Insert the following record at the Customer table.
Record No. 1
CustomerID -1
LastName -Tokyo
FirstName -Shoji
Contact -080-1234-5678
Address -Kanda, Chiyoda-ku
Record No. 2
CustomerID -2
LastName -Osaka
FirstName -Shokai
Contact -080-5679-1234
Address -Doyama-cho, Kita-
ku, Osaka City
Record No. 3
CustomerID -3
LastName -Chugoku
FirstName -Shonen
Contact -080-5679-1235
Address -Moto-machi, Naka-
ku, Hiroshima City
Record No. 1
CategoryID -1
CategoryName - Pork
Record No. 2
CategoryID -2
CategoryName - Beef
Record No. 3
CategoryID -3
CategoryName - Chicken
Record No. 1
MenuID -1
MenuName - Sweet and Sour
Pork
CategoryID -1
Price -300
Record No. 2
MenuID -2
MenuName - Kung Pao Chicken
CategoryID -3
Price -200
Record No. 3
MenuID -3
MenuName - Ma Po Tofu
CategoryID -2
Price -350
Record No. 1
OrderID -1
CustomerID -3
DateOrdered -1999-08-07
Record No. 2
OrderID -2
CustomerID -1
DateOrdered -1999-09-01
Record No. 3
OrderID -3
CustomerID -2
DateOrdered -1999-07-28
Record No. 1
OrderDetailID -1
OrderID -3
MenuID -3
Quantity -5
Record No. 2
OrderDetailID -2
OrderID -1
MenuID -1
Quantity -3
Record No. 3
OrderDetailID -3
OrderID -2
MenuID -2
Quantity -4
Paste a screenshot of your query after the number. The screenshot will show that you
could extract the needed information correctly. Also, Write your name after this line.
Name: ________________________________
MenuName Price
Sweet and Sour 300
Pork
Kung Pao Chicken 200
Ma Po Tofu 350
TotalAmount
3450
8. Retrieve from OrderDetail table the OrderID, MenuID and Quantity wherein
quantity is less than
4.
10. Retrieve from menu table the menu names and prices wherein the price is from
300 to 350.
11. Retrieve from customer table the customer first name and last name in the records
wherein the CustomerID is 1 0r 3.
12. Retrieve from OrderDetail table the OrderID and MenuID wherein the quantity is 4
or larger.
Remarks