SQL Query Writing Assessment Test

SQL Query Writing

 50 Minutes
 5 Questions


This test evaluates a candidate's ability to write and understand SQL queries. The focus is on practical query writing, covering key concepts like data retrieval, filtering, joins, aggregation, and data manipulation (INSERT, UPDATE, DELETE). Candidates will be presented with scenarios based on real-world data structures, and they must write efficient SQL queries to solve the given problems.


Example Question:

Coding
Write an SQL query that calculates the total sum of sales amounts where the sale amount is greater than 115. The query should return a single column named total_sales, representing the sum of all qualifying sales amounts.

Given the sales table structure below:
+---------+------------+--------+
| sale_id | department | amount |
+---------+------------+--------+
|    1    | Electronics| 100.50 |
|    2    | Clothing   |  75.00 |
|    3    | Electronics| 200.00 |
|    4    | Home Goods | 150.75 |
|    5    | Clothing   |  50.25 |
|    6    | Electronics| 120.00 |
|    7    | Home Goods |  80.50 |
|    8    | Electronics| 300.00 |
|    9    | Clothing   | 125.50 |
|   10    | Home Goods |  90.00 |
+---------+------------+--------+

The query should only include sales with amounts greater than 115.