What's the total revenue for all items?
- SELECT sum(revenue) FROM items;
What's the average revenue for all items?
- SELECT avg(revenue) FROM items;
What's the minimum revenue for all items?
- SELECT min(revenue) FROM items;
What's the maximum revenue for all items?
- SELECT max(revenue) FROM items;
What the count for items with a name?
- SELECT count(name) FROM items;
Return all main courses. Hint: What ActiveRecord method would you use to get this?
- SELECT * FROM items WHERE course = 'main';
Return only the names of the main courses.
- SELECT name FROM items WHERE course = 'main';
Return the min and max value for the main courses.
- SELECT max(revenue), min(revenue) from items WHERE course = 'main';
What's the total revenue for all main courses?
- SELECT sum(revenue) from items WHERE course = 'main';
What is an INNER JOIN?
- Creates a table of the records that are matching from both tables being joined
What is a LEFT OUTER JOIN?
- Creates a table that contains all records in the left table (the one afer FROM), even if there is no match in the right table
What is a RIGHT OUTER JOIN?
- Creates a table that contains all records in the right table (the one not afer FROM), even if there is no match in the left table