5. Databases Networks

Sql — Quiz

Test your understanding of sql with 5 practice questions.

Read the lesson first

Practice Questions

Question 1

Which SQL command is used to define a new index on a table to improve query performance?

Question 2

Consider a database with two tables: \texttt{Employees} (\texttt{EmployeeID}, \texttt{Name}, \texttt{DepartmentID}) and \texttt{Departments} (\texttt{DepartmentID}, \texttt{DepartmentName}). Which SQL query would return the \texttt{Name} of all employees and their corresponding \texttt{DepartmentName}, including employees who are not assigned to any department?

Question 3

Which of the following SQL queries would correctly retrieve the names of customers who have placed more than 5 orders, assuming an \texttt{Orders} table with \texttt{CustomerID} and an \texttt{Customers} table with \texttt{CustomerID} and \texttt{CustomerName}?

Question 4

What is the purpose of the \texttt{CASE} statement in SQL?

Question 5

Consider a table named \texttt{Sales} with columns \texttt{ProductID}, \texttt{SaleDate}, and \texttt{Amount}. Which SQL query would calculate the total \texttt{Amount} for each \texttt{ProductID} for sales made in the year 2023?
Sql Quiz — A-Level Computer Science | A-Warded