4. Databases

Advanced Sql — Quiz

Test your understanding of advanced sql with 5 practice questions.

Read the lesson first

Practice Questions

Question 1

Which of the following correctly describes the logical order of evaluation in a SQL SELECT query?

Question 2

Which characteristic distinguishes a correlated subquery from a non‐correlated subquery?

Question 3

In the query: SELECT cust_id, sale_date, SUM(amount) OVER (PARTITION BY cust_id ORDER BY sale_date ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total FROM sales;, what does running_total represent?

Question 4

Which SQL query correctly retrieves the second highest salary in each department using window functions?

Question 5

To filter rows based on a window function result, such as selecting employees whose salary exceeds the department average computed by AVG(salary) OVER (PARTITION BY dept), which approach is required?