Professional Documents
Culture Documents
Past Year Question
Past Year Question
INSTRUCTIONS:
1. Use Individual SQL Lab Test Answer Template which can be downloaded from ITS232/ICT200
Lab Test Answer Submission system.
2. Make sure you have entered your Student No, Name, and Group in answer template.
3. Please convert your answer into PDF format before you upload into ITS232/ICT200 Lab Test
Answer Submission system.
1. Create a database name AECDB. You may give another database name if AECDB already
exists in you IBM DB2.
2. Create LECTURER table structure. Run DESCRIBE command to ensure the structure
successfully being created.
4. Create RESERVATION table structure. Run DESCRIBE command to ensure the structure
successfully being created.
5. Add new attribute LECTURERDEPARTMENT into LECTURER table. The data type is
VARCHAR(15).
7. Insert all data below into USETYPE table. Run SELECT command after insert all data to
ensure all data successfully saved into the table.
8. Insert all data below into RESERVATION table. Run SELECT command after insert all
data to ensure all data successfully saved into the table.
10. Show lecturer identification number, lecturer name, and number of reservations made by
all lecturer. Then, sort the output from highest number of reservation first.
11. Show reservation details made by a lecturer name ‘NURFATIHAH HARON’. The output
should display lecturer name, reservation date, reservation start time and end time
(display in 1 column) and also reservation use type. Sort the output from early
reservation date first.
12. Show all reservations made in October 2019. Reservation details need to be displayed
are lecturer identification number, lecturer name, reservation date, reservation start time
and end time (display in 1 column) and also reservation use type.
SELECT LECTURER_ID
FROM LECTURER
WHERE RESERVE_DATE
ORDER BY LECTURER_ID
14. Show number of reservations made in September 2019 according to reservation use
type.
At the last row, display ‘TOTAL NUMBER OF RESERVATION IN SEP 2019’ and its
value. Refer to sample output below.
TYPENAME NUMBER OF RESERVATION
DISCUSSION 1
TEST 1
CONSULTATION 4
TOTAL RESERVATION IN SEP 2019 6
SELECT TYPE_NAME,NUMBER_RESERVATION
FROM RESERVATION
END OF QUESTIONS