Databases (3)

Resources | Revision Questions | Computer Science

Login to see all questions

Click on a question to view the answer

1.

Question 3

A database table called Employees stores information about employees. The table has the following columns: EmployeeID (integer), EmployeeName (text), Department (text), and Salary (decimal).

SELECT Department, AVG(Salary)
FROM Employees
GROUP BY Department;
  

What does this SQL script do?

2.

A local charity wants to track donations received. Each donation has a DonationID, the name of the donor, the amount donated, and the date of the donation. The charity also wants to track the types of donations (e.g., cash, cheque, goods). Define a single-table database schema to store this information. Clearly state the fields and their data types.

3.

A program is designed to track the number of items in a shopping cart. The number of items can be any whole number, from 0 to a large number. Suggest a suitable data type for storing the number of items in the shopping cart and explain your choice. Also, briefly discuss any potential limitations of this data type in this context.