Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 9

FACULTY OF INFORMATION TECHNOLOGY

TUTORIAL 1
Answer Scheme

PROGRAMME TITLE Bachelor in Information Technology


UNIT TITLE (BIT3343) Database Design & Management
UNIT LECTURER Ms Idiana Abd Rahman

Instruction:
1. Please show the designing process by using Snipping tool to capture all successful
commands and paste it in the Microsoft Word.
2. Label the image based on question.
3. Save the document as (Your name and Batch).
4. Once completed, invigilator will save the document into the thumb drive / usb drive etc.

Answer the following questions.

1. Write the SQL code that will create a database. (1 Mark)


Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

Create tables based on Data Dictionary below.


Table Name Attribute Name Data Type Primary Key / Foreign Key
Foreign Key Referenced
Table

Franchise FranchiseID Char (3) PK None

Owner Char (30)

Address Char (50)

Menu Category Char (3) Index and not None


null

Chef Char (30)

MenuName Char (35)

Headquarters Franchise Char (3) FK Franchise

Category Char (3) FK Menu

Description Char(20)

Franchise table (4 Marks)

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 2
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

Menus table (4 Marks)


CREATE TABLE Menus
(
Category char(3) not null,
Chef char(15),
MenuName char(30),
price decimal(4,2)
)ENGINE=MYISAM CHARACTER SET UTF8;

Headquarters table (6 Marks)

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 3
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

2. Insert value for each table created.


Franchise (3 Marks)
FranchiseID Owner Address
F11 Mr Adam No 103 Block Time Square, Kuala Lumpur
F12 Mr Aiman Simpang 118-112-9 Kg Kiulap, Brunei
F13 Mr An’ama Lot 12. Sunway Lagoon, Subang

Menus (3 Marks)
Category Chef MenuName Price
M1 Chef Jac Chicken Chop 45.20

M2 Chef PuiYee Ikan Asam Pedas 10.30

M2 Chef Boboy Ayam Masak Tomato 15.10

M1 Chef Nana Spaghetti Bolognaise 50.30

M2 Chef Arasu Rendang Daging Pedas 23.00

M3 Chef Ariana Roti Canai Cheese Leleh 5.60

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 4
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

INSERT INTO Menus VALUE


('M1','Chef Jac','Chicken Chop','45.20'),
('M2','Chef PuiYee','Ikan Asam Pedas','10.30'),
('M2','Chef Boboy','Ayam Masak Tomato','15.10'),
('M1','Chef Nana','Spaghetti Bolognaise',50.30),
('M2','Chef Arasu','Rendang Daging Pedas','23.00'),
('M3','Chef Ariana','Roti Canai Cheese Leleh','5.60');

Headquarters (3 Marks)
Franchise Category Description
F11 M1 Western Cuisine
F12 M2 Malay Cuisine
F13 M3 Indian Cuisine
INSERT INTO Headquarters VALUE
('F11','M1','Western Cuisine'),
('F12','M2','Malay Cuisine'),
('F13','M3','Indian Cuisine');

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 5
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

Create the following queries:


a) Display column Category, Chef and Food Description ONLY for Malay Cuisine record.
(2 Marks)

b) Display column FranchiseID, Owner, Address, Category and FoodDescription ONLY for
Western Cuisine record. (2 Marks)

c) Display column Chef, Category and FoodDescription ONLY for Franchise ‘F13’ record.
(3 Marks)

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 6
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

d) Display column Chef, Owner, Category and FoodDescription ONLY for Franchise ‘F1’
and Western Cuisine record (using inner join). (3 Marks)

e) Counting the number of distinct Chef in the Menus table (2 Marks)

f) Display column Owner, Chef and MenuName begin with letter ‘R’ (3 Marks)

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 7
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

g) Display column FranchiseID, Owner, Address, MenuName and FoodDescription records.


(2
Marks)

h) Display the MIN and MAX Price. (2 Marks)

i) Display column Category, Chef, MenuName and Price where the price less than 50.30.

(2 Marks)

j) Display the Average_Price and Count_MenuName (2 Marks)

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 8
OF 9
Sept 2017- March 2018
Tutorial 1
BIT3343 Database Design & Management
____________________________________________________________________________________________________________________________________________________________

k) Display all records from table Franchise, Menus and Headquarters (3 Marks)

Total: 50 marks

******************************** END OF PAPER *******************************

KOLEJ IGS
FACULTY OF INFORMATION TECHNOLOGY PAGE 9
OF 9

You might also like