S3 Database (2023) - Assignment 2 (Teacher Verison)
S3 Database (2023) - Assignment 2 (Teacher Verison)
(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)
(c) SELECT NAME FROM STUDENT WHERE SCORE1 > 70 AND SCORE2 >
SCORE1
Clem
Ben
(4 marks)
(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)
(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 ~