Min, Max
aggregates2_1.sql
SELECT MIN(calories), title FROM menu /* supported since version 3.7.11 for MAX() and MIN() only. see: https://www.sqlite.org/lang_select.html#bareagg */
aggregates2_2.sql
SELECT MAX(price), title FROM menu WHERE price < 20.0 /* This isn't a fully correct answer yet. There are two items for $19.95, but this only yields 1. */
aggregates2_3.sql
SELECT title, price FROM menu WHERE price == ( SELECT MAX(price) FROM menu WHERE price < 20.0 ) /* This is a better solution. The nested query is executed first. Both $19.95 items will show. */
- Double-check the result of running the second query (that fails), then browse the entire data table to confirm that the second query isn't quite correct
- Given that the second query fails, is the first query correct? (answer - it is)
- The third query uses a subquery which will be covered later...
- Show the price, title and category of the menu item with the MAX price (model your answer on the first example above)