SQL1
SQL1
DESCRIPTION:
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
Insert the following record at the Category table.
Record No. 1
CategoryID -1
CategoryName - Pork
Record No. 2
CategoryID -2
CategoryName - Beef
Record No. 3
CategoryID -3
CategoryName - Chicken
2.
Retrieve CustomerID from order table.
3.
Retrieve OrderID, MenuID, and Quantity from OrderDetail table.
4.
Write an SQL statement to extract the display below.
MenuName Price
Ma Po Tofu 350
5.
Write an SQL statement to extract the display below.
6.
Write an SQL statement to extract the display below.
7.
Write an SQL statement to extract the display below.
TotalAmount
3450
8.
Retrieve from OrderDetail table the OrderID, MenuID and Quantity wherein quantity is less than
9.
Write an SQL statement to extract the display below.
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