0% found this document useful (0 votes)
6 views

S3 Database (2023) - Assignment 2 (Teacher Verison)

Uploaded by

tszyuet yan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

S3 Database (2023) - Assignment 2 (Teacher Verison)

Uploaded by

tszyuet yan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

P.

HKTA Tang Hin Memorial Secondary School


S3 Computer Literacy – Database 2023
Assignment 2 (Chapter 3 – 4)

Name: ________________ Class: ________( ) Marks: ________ / 22

Section A – Multiple Choices (5 marks)


1. Which of the following are objects in a common DBMS?
(I) Table
(II) Form
(III) Query
(IV) Report
A. (I) and (II) only
B. (II) and (III) only
C. (I), (II) and (IV) only
D. All of the above*

2. Which of the following is not the advantage of using a form in a DBMS?


A. Enhanced User Interface
B. Data Validation
C. Customization and Layout Control
D. Compatibility with Multiple Devices*

3. Which of the following cannot be modified in a report?


A. Resize rows and columns
B. Delete fields
C. Real-Time Data Updates*
D. Add aggregate field

4. Which SQL keyword is used to retrieve data from a database table?


A. SELECT*
B. FROM
C. WHERE
D. INSERT

5. Which of the following is an invalid SQL statement?


A. SELECT NAME,CLASS FROM MYTABLE WHERE CLASS = ‘1A’
B. SELECT NAME,CLASS FROM MYTABLE WHERE 1 = 1
C. SELECT 10 FROM MYTABLE WHERE NO = 10
D. SELECT CLASS FROM MYTABLE ORDER BY NO WHERE CLASS = ‘1A’ *
P.2

Section B – Short Questions (5 marks)


1. What is the function of a form in Microsoft Access?
A form provides a user-friendly interface for user to manage data.

(1 mark)

2. What is the advantage of using a form for data entry over using a table?
It is easier to view or get the items in a table / It is essential for efficiency and data
entry accuracy.
(1 mark)

3. What is a query?
A query is a request for performing a certain action in the database (1M), e.g., adding,
deleting, modifying or reviewing data. (1M)
(1 mark)

4. Suggest five common datatypes of fields in a table.


Short Text, Long Text, Number, Large Number, Date/Time, Yes/No, etc. (2M for all)
(2 marks)

Section C – SQL statements (12 marks)


1. Refer to the following table “student”.

What is the output of the following SQL query?


(a) SELECT (SCORE1 + SCORE2) FROM STUDENT WHERE SID = ‘03506’
113
P.3

(b) SELECT NAME, SCORE1 FROM STUDENT WHERE SCORE2 > 80


Clem 81
Eva 62
Ben 73

(c) SELECT NAME FROM STUDENT WHERE SCORE1 > 70 AND SCORE2 >
SCORE1
Clem
Ben

(d) SELECT NAME, CLASS FROM STUDENT WHERE (CLASS = ‘1B’ OR


CLASS = ‘1C’) AND DOB < ‘2013-08-01’ ORDER BY NAME
Dio 1C
Eva 1B
Finn 1B

(4 marks)

2. The following shows the records of a ‘Member’ table of a tennis club.


loginID password sex name registerDate
Chris123 123action M Chris Chan 2009-09-06
Dingo05 Car888 M Dingo Lo 2009-10-05
Alice706 Hello123 F Alice Lin 2009-11-06
Paul911 Gooday M Paul Lam 2009-12-11
Susan64 Friend009 F Susan Cheng 2010-01-01
Venus001 Twocat F Venus Fung 2010-01-12

(a) Write a SQL statement to retrieve the record of a member whose name is Alice Lin.
SELECT * FROM Member WHERE name = 'Alice Lin'
(1 mark)

(b) The database administrator of the club wants to print a list of members’ names, login IDs and
passwords. Write a SQL statement to help him retrieve the information.
SELECT name, loginID, password FROM Member
(1 mark)
P.4

(c) Write a SQL statement to retrieve the record of a member whose register date is earlier
than 2009-12-31.
SELECT * FROM Member where registerDate < ‘2009-12-31’
(1 mark)

3. A table ‘member’ table store the members of STEM and ICT club. Some of the records are as follows.
Sid Class No Name Post
190123 1A 4 Steven Chan
190233 1A 5 Arthur Wong Committee
190882 1B 7 Jenny Yip Secretary
201542 2C 11 Karmen Chen
213222 3B 8 Jordan Lee
215231 3C 12 Karina Ma Chairman
(note: NO is number type and others are text type)

Write a SQL statement for the following.


(a) To list the records of members in S1 (i.e. 1A to 1E)
SELECT * FROM member WHERE name in (‘1A’, ‘1B’,’1C’,’1D’,’1E’)
(1 mark)

(b) To list the records of members with surname ‘Wong’.


SELECT * FROM member WHERE name like ‘% Wong’ (note the space before WONG)
(1 mark)

(c) To list the records of members in 1A whose class number is between 1 and 10 inclusively
SELECT * FROM member WHERE No >= 1 and No <= 10 and class = ‘1A’
(1 mark)

(d) To list the records of members who do not have a post in the STEM and ICT club.
SELECT * FROM member WHERE post IS NULL
(1 mark)

(e) To list the class and name of members who have a post in the STEM and ICT club and
his/her student ID (Sid) begins with ‘21’
SELECT class, name FROM member WHERE sid like ‘21%’ and post is not null
(1 mark)

~ END OF PAPER ~

You might also like