Loading topic
GROUP BY splits a table into groups first, so you get one value per group. Every conditional aggregation technique in this tutorial builds on these two ideas. This chapter reviews them, with attention to the details that matter later: ho7 min readSELECT, WHERE and GROUP BY queries and have used count, sum and avg. It also assumes you know that a comparison with NULL is neither true nor false. Every example uses the orders table from the previous chapter. The status values are 'paid', `'ref7 min readFILTER clause: its syntax, where it sits in query evaluation, and how to read and write it. It assumes you can write SELECT, WHERE and ORDER BY. It also assumes you know count, sum and avg with GROUP BY, and that you know NULL means "unknown" in SQL. `FI5 min readGROUP BY queries and know that count, sum and avg skip NULL inputs. It also assumes you have seen conditional aggregation written with CASE, as in the previous chapters. All examples use the orders table from the start of the tutorial.5 min readcount, sum, avg, min, max), and you know that NULL means "unknown or missing value" in SQL. It uses the orders table from the earlier chapters.7 min readorders table. You compute the totals, the paid revenue and a refund percentage in a single scan, and you check how each column behaves when a month has no matching rows.5 min readFILTER (WHERE ...) and the CASE-inside-aggregate pattern from earlier chapters. All examples use the orders table:6 min readGROUP BY queries and know that FILTER (WHERE ...) restricts the rows an aggregate sees. It also assumes you know how count and sum treat NULL. It uses the orders table from earlier chapters. Here you combine FILTER with the options that live inside an a6 min readGROUP BY aggregates work, you have met FILTER (WHERE ...) on grouped aggregates, and you have seen basic window syntax (OVER, PARTITION BY, ORDER BY). It uses the orders table from earlier chapters.7 min readFILTER aggregates on top of GROUPING SETS, ROLLUP and CUBE.7 min readEXPLAIN and EXPLAIN ANALYZE at a basic level, and that you know the orders table and the FILTER (WHERE ...) syntax from earlier chapters. Here you will measure what a filtered aggregate costs, compare it with several separate queries, and read the plan to con7 min readGROUP BY queries and have used count, sum and avg. You should also know that NULL means "unknown" and that comparisons with it are never true. It also assumes you have met FILTER (WHERE ...) in the earlier chapters. All examples use the orders table f7 min read