You are on page 1of 7

© Vocational Training Council

IVE Information Technology

Information & Communications


Technology

Programme Board

Instructions:
(a) This paper has a total of SEVEN pages HIGHER DIPLOMA IN
including the cover page. INFORMATION AND NETWORK SECURITY
(b) This paper contains FOUR questions. (IT114104)
(c) Answer ALL questions.
Note: The result of this assessment will not be SOFTWARE ENGINEERING
counted if you do not meet the minimum (IT114105)
attendance requirement (if any) governed
by the general academic regulations of your GAME SOFTWARE DEVELOPMENT
(IT114107)
programme/course unless approval of the
campus principal has been granted.
CLOUD AND DATA CENTRE
ADMINISTRATION
(IT114115)

COMPUTER SYSTEMS ADMINISTRATION


(IT124106)

MODULE TITLE:
DATABASE PRINCIPLES
MODULE CODE: ITP4903

SEMESTER ONE
MAIN EXAMINATION

12 JANUARY, 2016
1:30 PM TO 3:30 PM (2 hours)
© Vocational Training Council

Information Technology Discipline Page 1 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1

This paper contains FOUR questions.


Answer ALL questions.

Q1 Given the following relations of an Online Game Ordering system and the database schema
with sample data found in the Appendix on page 5 and 6:

Platform (PlatformNo, PlatformDesc, DevCompany, LaunchDate, Portable)


Game (GameNo, GameDesc, StockQuantity, Medium, PlatformNo)
Client (ClientNo, UserName, UserPassword, CreditCardNo, Country)
Purchase (GameNo, ClientNo, PurchaseDate)

where the underlined attributes are the primary key attributes.

Assume that tables Platform, Game and Client had been created with primary key and
foreign key in database and given the following specification of the Purchase table:

Purchase
Column Name Type: Length Null? Key(s)
GameNo Character: 5 No (1) Composite primary key attribute
(2) Foreign key, refers to Game table
ClientNo Character: 5 No (1) Composite primary key attribute
(2) Foreign key, refers to Client table
PurchaseDate Date No

Write a SINGLE SQL statement for each of the following questions:

(a) Add a new column named GameType to the Game table so that it can accept only
THREE characters. [2 marks]

(b) Set a default value on the column LaunchDate of the Platform table to be the date
when the record is added. [2 marks]

(c) Add a constraint named platform_cc to the Platform table so that the value for column
DevCompany must be N, M, or S. [3 marks]

(d) Create the table Purchase using the above table specification with purchase_pk,
purchase_fk1 and purchase_fk2 as the constraint names for the primary key and the
two foreign keys respectively. [7 marks]

(e) Change the data type of the column GameDesc of the Game table so that users can
either input up to 250 characters or leave it empty. [2 marks]

(f) Create an index named client_idx on the column UserName of the Client table in
descending order. [2 marks]

(g) Remove the constraint platform_cc that was created in the Q1(c). [2 marks]

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)


© Vocational Training Council

Information Technology Discipline Page 2 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1
Q2 Given the following relations of an Online Game Ordering system and the database schema
with sample data found in the Appendix on page 5 and 6:

Platform (PlatformNo, PlatformDesc, DevCompany, LaunchDate, Portable)


Game (GameNo, GameDesc, StockQuantity, Medium, PlatformNo)
Client (ClientNo, UserName, UserPassword, CreditCardNo, Country)
Purchase (GameNo, ClientNo, PurchaseDate)

where the underlined attributes are the primary key attributes.

Write a SINGLE SQL statement for each of the following questions:

(a) Add the following record to the Purchase table. [2 marks]

GameNo ClientNo PurchaseDate


G0003 C0004 04-JAN-16

(b) Change the credit card number to AC-5678-123-BBB for the client with client number
C0005. [3 marks]

(c) Remove the purchase record with game number G0003 and client number C0004.
[2 marks]

(d) For each platform number, show the total number of copies of games in the stock.
[3 marks]

(e) Display the game number and game description for the games with platform number
P0009. Sort the list by descending order of game description. [2 marks]

(f) Display the game description, number of copies in the stock and platform description
for the games with the number of game copies in the stock less than 50. [3 marks]

(g) Display the user name and the number of purchase for the clients who had purchased
two or more times. [5 marks]

(h) Display the purchase details (game description, user name and purchase date) for all
purchases made in February 2015. [5 marks]

(i) Show the game number and game description for all the games without value for the
storage medium. [2 marks]

(j) Create a view named v_chinauser with the client number and user name from the
Client table. The view should include the clients in China only. [3 marks]

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)


© Vocational Training Council

Information Technology Discipline Page 3 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1

Q3 Consider the following Equipment table with sample data of a studio equipemnt rental
company in Hong kong:

EQUIPMENT
EqNo Type TypeDesc DailyRate CustID CustName Phone StartDate RentDay TotalCost
C110 CM1 Nicon D4 2000 C011 McApline 95113211 2014-2-2 3 6000
C033 Chan 92512399 2014-3-9 2 4000
C044 Wong 21787654 2014-4-12 1 2000
T102 TRP Gitso 500 C033 Chan 92512399 2014-2-21 2 1000
Tripod C055 Groot 24651234 2014-6-19 3 1500
C120 CM2 Nicon D80 1400 C099 Cheung 99562231 2015-2-11 4 5600
C130 CM2 Nicon D80 1400 C033 Chan 92512399 2015-2-11 3 4200
M100 MIC Hand microphone 100 C066 Lacino 98512889 2014-2-27 2 200
C055 Groot 24651234 2014-7-29 1 100

Where
EqNo = unique equipment number; Type = type of equipment;
TypeDesc = description of an equipment type; DailyRate = daily rental rate of an equipment;
CustID = customer ID; CustName = customer’s last name;
Phone = customer phone number; StartDate = start date of an equipment rental;
RentDay = number of days for a rental; TotalCost = total cost for an equipment rental.

Assumption:
1. Each equipment available for rent has a unique number and has been assigned with one
equipment type only. Each equipment type has at least one equipment.
2. All equipment with the same equipment type has the same rate for rent.
3. The same equipment cannot be rented for more than once in the same day.
4. A customer can rent the same equipment in different dates.
5. All equipment have been rented for at least once and all customers have rented
equipment at least once.

(a) Name and describe the THREE types of database anomalies that may happen in the
above EQUIPMENT table. [6 marks]

(b) (i) Write down the unnormalized form (UNF) for the EQUIPMENT relation.
[2 marks]

(ii) Normalize the EQUIPMENT relation to the third normal form (3NF).
Show ALL your steps from 1NF to 3NF by listing all the relations in 1NF, 2NF
and 3NF. Underline the primary key attribute(s) for each relation in your answer.
[12 marks]

(c) Draw an entity relationship diagram to represent the normalized relations in 3NF based
on the given assumptions. Make sure that all entities must be labelled and relationships
must be drawn with the correct symbols. [10 marks]

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)


© Vocational Training Council

Information Technology Discipline Page 4 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1

Q4 (a) Describe the meaning of database. [2 marks]

(b) Given the following relations of the appointment system of a clinic:


DOCTOR (DoctorNo, DoctorName, DoctorAddress, DoctorTel)
PATIENT (PatientNo, PatientName, PatientTel)
APPOINTMENT (DoctorNo, PatientNo, AppointDate, AppointTime, Description, Fee)

Assume a patient can have only one appointment with a doctor on a specified date.
Define the following database terms, and give ONE example for EACH term with
suitable attribute(s) in the above relations. You should indicate the corresponding
relation names and attribute names in your examples.

(i) Composite Primary Key; [3 marks]


(ii) Foreign Key. [2 marks]

(c) Given the following sample data of the PATIENT relation:


PatientNo PatientName PatientTel
P0123 Anson Au 98765423
P0218 Jacky Siu 95411280
P1167 Miranda Kwan 61789112
P1222 Daniel Cheng 50091104
P3478 Judy Yeung 93386664

(i) (1) Describe the meaning of Data Dictionary in a database management system.
[1 mark]

(2) Give FOUR examples of metadata for the attribute PatientNo in the
PATIENT relation. [2 marks]

(ii) Describe the meaning of the following database terms and give a value for each of
them using the above sample data given in Q4(c) in the PATIENT relation:

(1) Attribute; [1 mark]


(2) Tuple. [1 mark]

(d) (i) Describe how the Entity Integrity rule can be enforced in the DOCTOR relation
given in Q4(b). [2 marks]

(ii) Describe how the Referential Integrity rule can be enforced in the
APPOINTMENT relation given in Q4(b). [4 marks]

(e) Name and Describe one type of data independence that can be achieved by the ANSI-
SPARC Three-level Architecture in a database management system. [2 marks]

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

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)


© Vocational Training Council

Information Technology Discipline Page 5 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1
APPENDIX

Database schema of the Online Game Ordering system with sample data as follows:

Platform (PlatformNo, PlatformDesc, DevCompany, LaunchDate, Portable)


Game(GameNo, GameDesc, StockQuantity, Medium, PlatformNo)
Client(ClientNo, UserName, UserPassword, CreditCardNo, Country)
Purchase(GameNo, ClientNo, PurchaseDate)

where the underlinded attributes are the primary key attributes and:
PlatformNo = Platform Number, PlatformDesc = Platform Desctiption,
DevCompany = Development Company, LaunchDate = Launch Date of the platform,
Portable = Is the platform portable, GameNo = Game Number,
GameDesc = Game Description, StockQuantity = Number of the copies in stock,
Medium =Storage medium of the game, ClientNo = Client Number,
UserName = Login name, UserPassword = Login password,
CreditCardNo = Credit card number, Country = Client Country,
PurchaseDate = The date the game purchased.

Platform
PlatformNo PlatformDesc DevCompany LaunchDate Portable
P0001 Nintendo Wii N 09-SEP-01 N
P0002 Nintendo Wii U N 17-JAN-14 N
P0003 Nintendo NDS N 12-DEC-01 Y
P0004 Nintendo 3DS N 15-OCT-03 Y
P0005 Sony Playstation 3 S 11-NOV-07 N
P0006 Sony Playstation 4 S 01-JUN-14 N
P0007 Sony Playstation Portable S 14-FEB-05 Y
P0008 Sony Playstation V S 11-NOV-12 Y
P0009 Microsoft XBox 360 M 04-MAR-03 N
Note: LaunchDate 09-SEP-01 means 9 September 2001

Game
GameNo GameDesc StockQuantity Medium PlatformNo
G0001 Dead island 55 Disk P0009
G0002 Heavy Rain 42 P0009
G0003 F.E.A.R. 72 Disk P0009
G0004 The evil within 67 Blue Ray P0005
G0005 Slient Hill 5 78 P0003
G0006 Resident Evil Remake 90 Blue Ray P0002
G0007 Clock Town 55 Disk P0006
G0008 King Of Fighter 68 Disk P0004
G0009 Love Plus Plus 55 Disk P0003

Client
ClientNo UserName UserPassword CreditCardNo Country
C0001 Gray Choy asikpoowsaas XX123-345XX China
C0002 Webster Woo nopassword AA125-09333AA China
C0003 Eden Wong blankpass CB19099-231AA U.S.A.
C0004 Cell Chow passwordisdump DD123-90333-AA HK
C0005 Jeff So iamtoosmart AC-7892-111-AAA Japan

(Appendix – to be continued on the next page)

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)


© Vocational Training Council

Information Technology Discipline Page 6 of 6


Course/Programme/Year: IT114104/1, IT114105/1, IT114107/1, IT114115/1, IT124106/1

(Appendix continues from the previous page)

Purchase
GameNo ClientNo PurchaseDate
G0008 C0003 01-JAN-15
G0009 C0003 14-FEB-14
G0001 C0001 01-MAY-12
G0004 C0004 11-MAY-15
G0005 C0002 14-FEB-15
Note: PurchaseDate 01-JAN-15 means 1 January 2015

***** END OF APPENDIX *****

Database Principles (ITP4903) Main Examination Semester 1 (2015/2016)

You might also like