Showing posts with label group by. Show all posts
Showing posts with label group by. Show all posts

Saturday, January 2, 2016

SQL -- Aggregate Functions (Group by, MIN, MAX)


From the items_ordered table, select the item, maximum price, and minimum price for each specific item in the table. 







SELECT item, MAX(price), MIN(price)

FROM items_ordered

GROUP BY item;

Friday, November 27, 2015

SQL -- Aggregate Functions (Group By)


How many people are in each unique state in the customers table? Select the state and display the number of people in each. 



SELECT state, count(state)
FROM customers
GROUP BY state;