1415 Sem 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

© Vocational Training Council

IVE Information Technology

Information & Communications


Technology

Programme Board

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

MODULE TITLE:
DATABASE PRINCIPLES
MODULE CODE: ITP4903

SEMESTER ONE
MAIN EXAMINATION

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

Information Technology Discipline Page 1 of 5


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

This paper contains FOUR questions.


Answer ALL questions.

Q1 Given the following relations of a Conference Presentation Management System and the
database schema with sample data found in the Appendix on page 5:

Presenter (PresenterNo, PresenterName, PType, Address, Phone)


Presentation (PresentationNo, PresentationName, PresentationDate, Location, PresenterNo)
Customer (CustomerNo, CustomerName, Email, CPhone)
Registration (CustomerNo, PresentationNo, RegistrationDate)

where the underlined attributes are the primary key attributes.

Assume that tables Presenter, Presentation and Customer had been created with primary key
and foreign key in database and given the following specification of the Registration table:

Registration
Column Name Type: Length Null? Key(s)
CustomerNo Character: 4 No (1) Composite primary key attribute
(2) Foreign key, refers to Customer table
PresentationNo Character: 5 No (1) Composite primary key attribute
(2) Foreign key, refers to Presentation table
RegistrationDate Date Yes

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

(a) Create the table Registration using the above table specification with registration_pk,
registration_fk1 and registration_fk2 as the constraint names for the primary key and
the two foreign keys respectively. [7 marks]

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

(c) Change the data type of the column Address of the Presenter table to accept up to 250
characters. [2 marks]

(d) Add a constraint named presenter_ptype_cc to the Presenter table so that the value for
presenter type must be H, M, or L. [3 marks]

(e) Create an index named presenter_idx on the column PresenterName of the Presenter
table. [2 marks]

(f) Add a new column named Gender to the Customer table so that it can accept only ONE
character. [2 marks]

(g) Remove the column Gender which added in Q1 (f). [2 marks]

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


© Vocational Training Council

Information Technology Discipline Page 2 of 5


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

Q2 Given the following relations of a Conference Presentation Management System and the
database schema with sample data found in the Appendix on page 5:

Presenter (PresenterNo, PresenterName, PType, Address, Phone)


Presentation (PresentationNo, PresentationName, PresentationDate, Location, PresenterNo)
Customer (CustomerNo, CustomerName, Email, CPhone)
Registration (CustomerNo, PresentationNo, RegistrationDate)

where the underlined attributes are the primary key attributes.

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

(a) Add a new record to the Customer table with the following information.

CustomerNo CustomerName Email CPhone


C234 Mike Scott mikescott@gmail.com 98765432
[3 marks]

(b) Change the phone number to 91234567 for the customer with customer number C012.
[3 marks]

(c) Remove the registration record of the customer who has customer number C249 and
had registered to the presentation with presentation number PS202. [2 marks]

(d) Display the customer name and email of all customers with email account at gmail.
[2 marks]

(e) Display the presenter name and phone number of all the presenters belonging to the
presenter type H. [2 marks]

(f) For the presentation with 2 or more registered customers, show the presentation
number and the number of registered customer in ascending order of the presentation
number. [4 marks]

(g) Display the customer name and registration date of the presentation with the
presentation number PS202. [3 marks]

(h) Display the registered customer name, presentation name and presenter number for
presentations NOT presented by presenters of the presenter type H. [6 marks]

(i) Display the locations of the presentation and their number of presentation in year 2014.
[3 marks]

(j) Display the presenter number, presenter name and phone number for all presenters
WITHOUT address. [2 marks]

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


© Vocational Training Council

Information Technology Discipline Page 3 of 5


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

Q3 Consider the following Activity relation with sample data records provided by a non-
governmental organisation which organises different types of activities for old persons.

Activity
ActivityID ActivityName Place ADate SupNo SupName VolunteerNo VolunteerName Task
A1001 Mid-Autumn Kai Shing 01-09-14 S023 KoKo 11121314 Rex Ma Game Designer
Festival Elderly Wong
Celebration House 12131415 Joe Lin Gift Distributor

12567787 Jacky Yiu Helper

13000123 Roy Siu Helper


A1003 Fitness Tsing Yi 10-10-14 S007 Teresa 12131415 Ben Au Instructor
Play-in Sports Centre Tang
12553498 June Chan Demonstrator

13000123 Roy Siu Demonstrator


A1010 Hydro Fitness JC Sha Tin 12-12-14 S015 Ken Wong 12335533 Yang Sun Coach
Training Course Swimming
for Elderly Pool 12553498 June Chan Demonstrator

12567787 Jacky Yiu Helper

Where
ActivityID = Activity ID number, ActivityName = Activity name,
Place = The place to hold the activity, ADate = Date of the activity,
SupNo = Supervisor number of the activity, SupName = Name of activtiy supervisor,
VolunteerNo = Volunteer number, VolunteerName = Volunteer name,
Task = Task responsible by the volunteer in the activity.

Assumption:
Every volunteer can help in one or more activities. Every activity has it own activity
number and has at least two volunteers assigned to it. There is a policy that every activity
supervisor must supervise at least one activity, and each activity has only one supervisor. A
volunteer can take up different tasks in different activities.

(a) Name and describe the THREE types of database anomalies that may happen in the
data of the given Activity relation. [6 marks]

(b) Explain the term Functional Dependencies, and give FOUR functional dependencies
in the given Activity relation. [6 marks]

(c) (i) Write down the unnormalized form (UNF) for the Activity relation. [1 mark]

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

(d) Draw an entity relationship diagram to represent the normalized relations in 3NF given
in your answer in Q3 (c) with the given assumptions. [5 marks]

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


© Vocational Training Council

Information Technology Discipline Page 4 of 5


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

Q4 (a) Describe how Program-data Independence can be achieved by using database


approach. [2 marks]

(b) Given the following relations of the admission application system of a college:
COURSE (CourseNo, CourseName, CourseFee)
APPLICANT (ApplicantID, ApplicantName, ApplicantTel, Score)
APPLICATION (ApplicantID, CourseNo, Choice, Result)

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) Primary Key; [2 marks]


(ii) Foreign Key. [2 marks]

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


ApplicantID ApplicantName ApplicantTel Score
A0234 Richard Yim 98765432 14
A0888 John Ma 95402283 20
A1365 Alex Wan 67891234 23
A1622 Maggie Yeung 51104521 10
A4473 Damon Cha 96664888 18

(i) (1) Describe the meaning of metadata in the context of database. [1 mark]

(2) Give FOUR examples of metadata for the attribute ApplicantID in the
APPLICANT 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 APPLICANT relation:

(1) Cardinality; [1 mark]


(2) Degree. [1 mark]

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

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

(e) Name and give ONE description for each of the three levels of the ANSI-SPARC
Three-level Architecture in a database management system. [3 marks]

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

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


© Vocational Training Council

Information Technology Discipline Page 5 of 5


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

Database schema of the Conference Presentation Management System with sample data as follows:

Presenter (PresenterNo, PresenterName, PType, Address, Phone)


Presentation (PresentationNo, PresentationName, PresentationDate, Location, PresenterNo)
Customer (CustomerNo, CustomerName, Email, CPhone)
Registration (CustomerNo, PresentationNo, RegistrationDate)

where the underlinded attributes are the primary key attributes and:
PresenterNo = Presenter Number, PresentationDate = Presentation Date,
PresenterName = Presenter Name, Location = Location of Presentation,
PType = Presenter Type, CustomerNo = Customer Number,
Address = Address of Presenter, CustomerName = Customer Name,
Phone = Phone of Presenter Email = Email of Customer,
PresentationNo = Presentation Number, CPhone = Phone of Customer,
PresentationName = Presentation Name, RegistrationDate = Date of registration

Presenter
PresenterNo PresenterName PType Address Phone
P002 David Cooper H 32154721
P011 Mike Jobs H 300 Nathan Road 32647853
P045 Steven Wong Co L 20 Tai Kwok Tsui 96547811
P084 Noel Chu M 43 Tai O Road 23548121
P105 Margaret Chung Co L 63 Central Road 23514861

Presentation
PresentationNo PresentationName PresentationDate Location PresenterNo
PS005 Art and Science 03-SEP-13 Venue C P002
PS027 Musical Event 10-NOV-13 Room 201 P084
PS106 Light Show Strategies 19-DEC-13 Venue B P084
PS115 Cloud Computing 12-FEB-14 Room 783 P002
PS201 Group Processing 18-APR-14 Room 352 P105
PS202 Focused Engineering 15-JUL-14 Venue A P011

Customer
CustomerNo CustomerName Email CPhone
C012 Adnrei Smith adnreis@gmail.com 98456123
C016 Alexandre Bean ab2014@gmail.com 68745122
C028 Brian Bun brianbun@yahoo.com 51240056
C248 Tom Overland toverland@yahoo.com.hk 54128745
C249 Jimmy Chan jimmy@abc.com.hk 69874512
C357 Mary Gibson marygib@facebook.com 95648127
C451 Alice Wong alicewong@twitter.com 24512478

Registration
CustomerNo PresentationNo RegistrationDate
C451 PS201 15-APR-14
C249 PS202 10-JUL-14
C028 PS115 28-JAN-14
C249 PS115 28-JAN-14
C012 PS027 06-NOV-13
C451 PS202 09-APR-14

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


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

You might also like