You are on page 1of 3

DELHI PUBLIC SCHOOL BANGALORE EAST

Cambridge International
Academic Session 2022-23
Subject: Computer Science Topic: Database worksheet 1 Answer
Name: Class: IX Roll No. :

1. A database table called TestResults has been created to hold details of students’ test
results. Part of the table is shown below.

StudentID Surname Firstname Gender Result


5432 Khayat Hakim M 41
5478 Ashton Sam M 34
5479 Howe Gary M 31
5530 Mata Kelly F 66
5548 Ronson Sam M 64
5600 Walker Marcus M 59
5602 Moore Steven M 47
5739 Okello Paulette F 61
5814 Ashton Belinda F 28

(a) The maximum mark obtainable on the test was 70. Write the query to select all the
students who scored below half marks in the test. The output should be displayed in
order of surname and firstname.

Answer:

SELECT Surname, Firstname, Result

FROM TestResults

WHERE Mark <35

ORDER BY Surname, Firstname;

(b) Show the output from this query


Answer:

Surname Firstname Result


Ashton Belinda 28
Ashton Sam 34
Howe Gary 31

1
(c) Show the output from this query.

SELECT StudentID, Surname, Firstname, Gender, Result

FROM TestResults

WHERE Gender = ‘F’

ORDER BY Result;

Answer:

StudentID Surname Firstname Gender Result

5814 Ashton Belinda F 28

5739 Okello Paulette F 61

5530 Mata Kelly F 66

(c) Which field can be selected as primary key?

Answer: StudentID

(d) How many records and fields are there in the table ?

Answer : 9

Answer:

2
(c) Write the query to select all the students with more than 60 marks in History or
more then 60 marks in Geography in ascending order of StudentName.

Answer:

SELECT StudentName

FROM MARKS

WHERE History>60 OR Geography >60

ORDER BY StudentName;

(d) Show the output from this query

Answer :

Diana Abuur

Paul Smith

(e) Write the query to select and show the student names only of all student with less
than 40 marks in both maths and English.

Answer:

SELECT StudentName

FROM MARKS

WHERE Maths < 40 AND English < 40;

You might also like