Question 1
Consider the following SQL query:
SELECT department, AVG(salary)
FROM employees
GROUP BY department
HAVING AVG(salary) > 50000;
What does this query do?
Question 3
Consider the following SQL query:
SELECT *
FROM orders
WHERE order_date BETWEEN '2023-01-01' AND '2023-01-31' OR (total_amount > 1000 AND customer_id = 1);
What does this query do?
Question 6
In a window function, what does the ORDER BY clause within the OVER() clause determine?
Question 7
Consider the following SQL query:
SELECT customers.customer_id, customers.customer_name, COUNT(orders.order_id) AS order_count
FROM customers
LEFT JOIN orders ON customers.customer_id = orders.customer_id
GROUP BY customers.customer_id, customers.customer_name
HAVING COUNT(orders.order_id) > 5;
What does this query do?
Question 9
Which window function is used to assign a unique rank to each row within a partition?
There are 10 questions to complete.