SELECT product_name, price FROM products WHERE price > (SELECT AVG(price) FROM products); Temporary named result sets (using WITH ) for cleaner, more readable queries.
SELECT customer_name, email FROM customers LIMIT 10; Videos in this section focus on refining queries to retrieve specific information. the complete sql bootcamp 2020: go from zero to hero videos
FUNCTION(column) OVER (PARTITION BY group_column ORDER BY order_column) SELECT product_name, price FROM products WHERE price >
SELECT orders.order_id, customers.customer_name FROM orders INNER JOIN customers ON orders.customer_id = customers.customer_id; Subqueries: A query nested inside another query (in SELECT , FROM , or WHERE ). Filters groups after aggregation (unlike WHERE
SELECT department, AVG(salary) AS avg_salary FROM employees GROUP BY department; Filters groups after aggregation (unlike WHERE , which filters rows before aggregation).
WITH high_value_orders AS ( SELECT customer_id, SUM(amount) AS total FROM orders GROUP BY customer_id HAVING SUM(amount) > 1000 ) SELECT * FROM high_value_orders; The CASE expression works like an if-then-else statement.