A merchandising team wants to designate certain items as "premium"; in this case, "premium" means any item priced above the catalogue average. Hardcoding a cutoff means updating it whenever catalogue prices change, but filtering against the live average means it adjusts on its own. Using the products table, return id, name, and price for every product whose price is strictly above the average, ordered by price descending.
products
| column | type |
|---|---|
| id | INTEGER |
| name | TEXT |
| price | NUMERIC |
| category | TEXT |
| id | name | price | category |
|---|---|---|---|
| 1 | Widget | 10.00 | gadgets |
| 2 | Gadget | 25.00 | gadgets |
| 3 | Doohickey | 5.00 | tools |
| 4 | Thingamajig | 40.00 | tools |
| id | name | price |
|---|---|---|
| 4 | Thingamajig | 40.00 |
| 2 | Gadget | 25.00 |
The average price is (10 + 25 + 5 + 40) / 4 = 20.00. Widget (10.00) and Doohickey (5.00) are below the average; Gadget (25.00) and Thingamajig (40.00) are above it.