Loading topic
COUNT, SUM, AVG, MIN, MAX), what they do when no GROUP BY is present, and the errors that appear most often when you first use them. Later chapters build on this: NULL handling,6 min readSELECT ... FROM ... WHERE ... ORDER BY queries and that you know the aggregate functions COUNT, SUM, AVG, MIN and MAX from the earlier chapters. You should also know that NULL means "missing value". Joins are not needed here.5 min readSELECT ... FROM ... WHERE ... ORDER BY queries and have read the earlier chapters on aggregate functions, NULL handling, and single-column GROUP BY. All examples use an orders table with the columns order_id, customer_id, status, amount, and `sh6 min readSELECT, WHERE and ORDER BY queries. It also assumes you know how GROUP BY forms groups and how aggregates such as SUM and COUNT behave. Here the question is narrower: once a query has a GROUP BY, which expressions may appear in the SELECT list6 min readorders table with the columns order_id, customer_id, amount and status.5 min readSELECT ... FROM ... WHERE ... ORDER BY, know that NULL means a missing value, and have seen GROUP BY with COUNT and SUM. It covers the two places where a grouped query can filter data, what each place can see, and the mistakes that follow from mixing them5 min readGROUP BY query, know that every non-aggregated column in the SELECT list must be grouped, and know the logical order in which a query is evaluated. The examples use the orders table from earlier chapters: order_id, customer_id, amount, status 7 min readGROUP BY query, know that aggregates skip NULL inputs, and can read a CASE expression. You will turn rows of a category column into separate output columns, and you will learn the errors that most often break this technique.6 min readINNER JOIN and LEFT JOIN, and that you know GROUP BY, COUNT(*) versus COUNT(column), and how aggregates treat NULL. The examples use three tables: customers, orders and order_items.5 min readGROUP BY query with several columns, use HAVING, and read a CASE expression. It also assumes you know that NULL means a missing value. All examples use the orders table from the earlier chapters and run on PostgreSQL. The differences in other databases 5 min readGROUP BY query with COUNT, SUM and AVG. You should also know how WHERE and HAVING differ, and what a LEFT JOIN does. It does not teach window functions in full. It shows when a window function fits better than GROUP BY, and how to tell the two apa6 min readSELECT, WHERE, ORDER BY, INNER JOIN and LEFT JOIN, and that you know NULL means a missing value. It also assumes you have met COUNT, SUM, AVG, MIN, MAX, GROUP BY and HAVING in the earlier chapters. Here you will learn the errors that come 5 min read