A ICT200 LabTest May2023
A ICT200 LabTest May2023
SUGGESTED ANSWERS
CONFIDENTIAL 2 CS/LAB TEST/MAY 2023/ICT200
QUESTION 1
a) List all players' names, genders, and incomes. Display only those players who have gotten
more than RM50,000 and lives in Melaka. The output results must be sorted in descending
order by gender, followed by the income.
(3 marks)
b) Displays the players' names, levels, and contacts whose last names end with the word
"Deraman" and the ages are between 15 and 25 years old, and the level of expert only.
Sort the output from younger to older player.
(5 marks)
QUESTION 2
Based on above relational schemas, write the SQL commands to answer all questions given
below:
a) Display the names and addresses of speakers that the name begin with ‘Nurul’ and the
address is in Perak.
(3 marks)
b) List workshop details for all workshops that are handled by speaker Dr. Nurhaliza Kamil.
(4 marks)
SELECT WSCode, WSName, StartDate, StartTime, SPCode, SPName, SPSex (1.0 mark)
FROM WORKSHOP W, SPEAKER S (1.0 mark)
WHERE S.SpeakerID = W.SpeakerID (1.0 mark)
AND SPName = ‘Dr Nurhaliza Kamil’ (1.0 mark)
c) Calculate how many workshops are handled by speaker Encik Amran Kassim. In output,
displays the speaker’s name and total workshop that he handled. Replace calculated
column name using TOTAL WORKSHOP.
(5 marks)
d) Display the workshop name, start date, venue description and location for all workshops
that are run in venue with a capacity greater than and equal to 300. Sort the output
according to workshop name in descending.
(5 marks)
QUESTION 3
a) Show the average high score of athletes for each team. Display the team number, team
name, average high score, and the number of people in each group. Include only those
groups that have two or more people.
(5 marks)
b) Using subquery, display athlete’s id, first name, allowance and team number who acquired
less than the average high score.
(5 marks)