What query calculates the cumulative sum of sales within each category?, SELECT category_id, sales_amount, SUM(sales_amount) OVER (PARTITION BY category_id ORDER BY order_date) AS cumulative_sales FROM sales;, SELECT SUM(sales_amount) FROM sales GROUP BY category_id;, SELECT sales_amount FROM sales WHERE category_id IS NOT NULL;, SELECT SUM(sales_amount) FROM sales;, How do you retrieve the difference in salary between each employee and their department's average?, SELECT * FROM employees WHERE salary = AVG(salary);, SELECT DISTINCT department_id, salary FROM employees;, SELECT salary FROM employees ORDER BY salary;, SELECT employee_id, salary, salary - AVG(salary) OVER (PARTITION BY department_iAS salary_diff FROM employees;, How do you find all customers who have placed at least three orders?, SELECT customer_id FROM orders GROUP BY customer_id HAVING COUNT(order_i>= 3;, SELECT DISTINCT customer_id FROM orders WHERE COUNT(order_i>= 3;, SELECT customer_id FROM orders WHERE order_id >= 3;, SELECT * FROM customers WHERE orders >= 3;, What query finds customers who have never placed an order?, SELECT customer_id FROM customers WHERE orders = 0;, SELECT * FROM customers WHERE customer_id NOT IN (SELECT customer_id FROM orders);, SELECT DISTINCT customer_id FROM orders;, SELECT customer_id FROM orders WHERE order_id IS NULL;, How do you find the median salary from an employees table?, SELECT AVG(salary) FROM employees;, SELECT salary FROM ( SELECT salary, ROW_NUMBER() OVER (ORDER BY salary) AS row_num, COUNT(*) OVER() AS total_rows FROM employees) ranked WHERE row_num = total_rows / 2 OR row_num = (total_rows / 2) + 1;, SELECT MEDIAN(salary) FROM employees;, SELECT salary FROM employees WHERE salary > 0;, How do you retrieve the last three orders placed by each customer?, SELECT employee_id FROM employees WHERE salary = salary;, SELECT DISTINCT employee_id FROM employees;, SELECT employee_id FROM employees ORDER BY salary;, SELECT e1.* FROM employees e1 JOIN employees e2 ON e1.department_id = e2.department_id AND e1.salary = e2.salary AND e1.employee_id <> e2.employee_id;, How do you find employees who have the same salary as another employee in the same department?, SELECT DISTINCT employee_id FROM employees;, SELECT e1.* FROM employees e1 JOIN employees e2 ON e1.department_id = e2.department_id AND e1.salary = e2.salary AND e1.employee_id <> e2.employee_id;, SELECT employee_id FROM employees WHERE salary = salary;, SELECT employee_id FROM employees ORDER BY salary;, What query retrieves employees who have a direct manager?, SELECT e1.employee_id, e1.name, e2.name AS manager_name FROM employees e1 JOIN employees e2 ON e1.manager_id = e2.employee_id;, SELECT * FROM employees WHERE manager_id IS NOT NULL;, SELECT DISTINCT employee_id FROM employees;, SELECT employee_id FROM employees ORDER BY manager_id;, How do you find the percentage contribution of each product to total sales?, SELECT product_id, SUM(sales_amount) AS product_sales, SUM(sales_amount) * 100.0 / SUM(SUM(sales_amount)) OVER () AS percentage_contribution FROM sales GROUP BY product_id;, SELECT DISTINCT product_id, SUM(sales_amount) FROM sales;, SELECT product_id FROM sales ORDER BY sales_amount;, SELECT * FROM sales WHERE sales_amount > 0;, How do you calculate the year-over-year growth in sales?, SELECT DISTINCT year, sales_amount FROM sales;, SELECT year, sales_amount, sales_amount - LAG(sales_amount) OVER (ORDER BY year) AS yoy_growth FROM sales;, SELECT year, SUM(sales_amount) FROM sales GROUP BY year;, SELECT year FROM sales ORDER BY sales_amount;.
0%
SQL Query-Based Quiz 3
Udostępnij
Udostępnij
Udostępnij
autor:
Helenojo2324
Edytuj elementy
Drukuj
Osadź
Więcej
Zadania
Tabela rankingowa
Pokaż więcej
Pokaż mniej
Ta tabela rankingowa jest obecnie prywatna. Kliknij przycisk
Udostępnij
, aby ją upublicznić.
Ta tabela rankingowa została wyłączona przez właściciela materiału.
Ta tabela rankingowa została wyłączona, ponieważ Twoje opcje różnią się od opcji właściciela materiału.
Przywróć poprzednie opcje
Test
jest szablonem otwartym. Nie generuje wyników w tabeli rankingowej.
Wymagane logowanie
Motyw
Czcionki
Wymagany abonament
Opcje
Zmień szablon
Pokaż wszystko
Więcej formatów pojawi się podczas wykonywania ćwiczenia.
)
Otwórz wyniki
Kopiuj link
Kod QR
Usuń
Przywrócić automatycznie zapisane ćwiczenie:
?