Welcome to TDBSoverflow, Our class's own StackOverflow. Our rules:
  1. Use only meaningful and self-explanatory titles
  2. Tag your questions with meaningful keywords
  3. Use upvotes and downvotes to rate the answers
  4. When you receive a satisfying answer - Click the "V" button
Remember: you may get up to 5 bonus points to your final grade!

Q6 - A hint?

+2 votes

I'm having trouble finding the trick to Q6, I already managed to create a query for summing the profits by months and stores at the same table, but how do I approach the difference between consecutive rows thing? Can we have a small hint?


asked Nov 19, 2017 by matan (480 points)

1 Answer

+2 votes

Don't think about consecutive rows, as there are many months missing (so maybe months in consecutive rows are not consecutive).

Instead, think about joining the table you created to itself, in a way that you'll get a row in the joined table for each couple of consecutive months.

(That's, of course, only one of many possible solutions)

answered Nov 19, 2017 by Assaf (31,090 points)