Question

You'd like to get the signup date of your last member. How can you retrieve this information?
Schema reminder
DB schema

Expected Results

latest
2012-09-26 18:08:45

Your Answer Hint Help Save Run Query


              

Answers and Discussion Show

select max(joindate) as latest
	from cd.members;          

This is our first foray into SQL's aggregate functions. They're used to extract information about whole groups of rows, and allow us to easily ask questions like:

  • What's the most expensive facility to maintain on a monthly basis?
  • Who has recommended the most new members?
  • How much time has each member spent at our facilities?

The MAX aggregate function here is very simple: it receives all the possible values for joindate, and outputs the one that's biggest. There's a lot more power to aggregate functions, which you will come across in future exercises.

Look up the SQL aggregate function MAX

Keyboard shortcuts:


Other hints: