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

Name: - Date

1. This document contains a mid-term assessment with 7 multiple choice questions on SQL queries relating to various database schemas describing branches, staff, properties, clients, owners, viewings, and registrations. Students are to fill in the blanks with the appropriate SQL keywords, table names, columns, functions etc. to write the SQL queries corresponding to the English language questions.

Uploaded by

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

Name: - Date

1. This document contains a mid-term assessment with 7 multiple choice questions on SQL queries relating to various database schemas describing branches, staff, properties, clients, owners, viewings, and registrations. Students are to fill in the blanks with the appropriate SQL keywords, table names, columns, functions etc. to write the SQL queries corresponding to the English language questions.

Uploaded by

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

Name: _________________ Date: ____________

SQL Mid-Term Assessment Questions (30 minutes)

Consider the following schema definitions:


Branch (branchNo, street, city, postcode)
Staff (staffNo, fName,lName, position, sex, DOB, salary, branchNo)
PropertyforRent (propertyNo, street, city, postcode, type, rooms, rent, ownerNo,
staffNo, branchNo)
Client (clientNo, fName, lName, telNo, prefType, maxRent)
PrivateOwner (ownerNo, fName, lName, address, telNo)
Viewing (clientNo, propertyNo, viewDate, comment)
Registration (clientNo, branchNo, staffNo, dateJoined)
For each case below, fill in the blanks such that the SQL queries correspond to the English language
queries stated. Each blank is worth 2 points.

1. List the address of all branch offices in London or Bristol.

SELECT *
FROM ______ ______
WHERE city=’London’ ____________

2. List the staff with a salary between $10000 and $30000.

SELECT staff_No
FROM Staff
WHERE ___________________________________

3. List the staff in descending order of salary.

SELECT staff_No, salary


FROM Staff
ORDER BY __ __________________

4. Find the number of different properties viewed in April 2004.


Name: _________________ Date: ____________

SELECT _____________
FROM Viewing
WHERE viewDate BETWEEN ‘1-Apr-04’ AND ’30-Apr-04’

5. Find the minimum, maximum and average staff salary.

SELECT _____________________________________
FROM Staff

6. For each branch office with more than one member of staff, find the number of staff working in
each branch and the sum of their salaries.
SELECT branchNo, ____________________
FROM Staff
GROUP BY branchNo
HAVING _______________

7. List the staff who work in the branch whose stree adress is ‘163 Main Street’

SELECT staffNo, fName, lName,


FROM Staff
WHERE __________ = (SELECT branchNo
FROM ______________
WHERE _____________)

8. Find the list of all cities where there is both a branch office and a property

(SELECT city
FROM Branch)
________________
(SELECT city
FROM ______________)

You might also like