Practice Center – Group By

Exercise 1

Display the following using the table sales:
  • one line per state
  • on this state, display the state name and the greatest revenue within this state

Expected result:

statemax(revenue)
Gujarat50000.00
Maharashtra40000.00
Uttar Pradesh30000.00



Exercise 2

Display the following using the table sales:
  • one line per state
    • for each state, display the state name as well as the average revenue and number of transactions within this state



Exercise 3

Show the names of the states (column state) where the number of transactions is equal to 6


Exercise 4

Show the name(s) of the states for which minimum revenue is strictly greater than 10000.


Exercise 5

Show the name(s) of the states for which minimum revenue is equal to or greater than 10000.


Exercise 6

Show the name(s) of the states for which maximum revenue is greater than or equal to 40098.34


Exercise 7

Show the name(s) of the states for which the sum of revenue is smaller than or equal to 93456.23.


Exercise 8

Display the following using the table sales taking into account only transactions from 2014 (column year):
  • one line per state
  • on this state, display the state name and the greatest revenue (column revenue) within this state



Exercise 9

Show the name(s) of the states for which maximum revenue is greater or equal to 30000 taking into account only transactions from 2013.


 
Share on:

Something not clear? Ask your question here:

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
 

Author:
Last udpated: June 8, 2016
Created: January 1, 2015