Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases SQL Reporting by Example Day 2: Advanced Selecting Students by Grade

Noah Fields
Noah Fields
13,985 Points

Math was Wrong

The difference between 6th and 7th grade was 17, not 27. As such, the growth curve is 24, followed by 17, for an average of 20.5.

Kareem Jeiroudi
Kareem Jeiroudi
14,984 Points

I didn't understand the calculation ?. How can you predict how many 6th graders will there be next year?

Marko Delgadillo
Marko Delgadillo
4,524 Points

I just saw this video and have NO IDEA how he got to the number of 6th graders from next year. Also, why was it in the lesson if it wasn't calculated with SQL? It threw me off.

Having said that, I am enjoying the videos and learning plenty :)

3 Answers

Ben Deitch
STAFF
Ben Deitch
Treehouse Teacher

D'oh! Thanks for keeping me honest! It looks like we'll be making an update to this video in the near future :)

Fredric von Stange
Fredric von Stange
3,867 Points

Mistakes happen, nbd. I'm really enjoying the video series so far. Keep up the good work Ben!

Four years later...

I don't think making mistakes in a video is a big issue, but when you do it repeatedly like in the previous video while trying to select the right columns it makes the example really hard to follow.

Andrew Federico
Andrew Federico
7,498 Points

Just saw this. I'll remove my other post.

So I must have missed something because the first thing I thought of was this:

SELECT COUNT(*), GRADE FROM STUDENTS GROUP BY GRADE;

But it was giving me a count of all students and so that led me to do UNIONS

SELECT COUNT(*) AS student_count, GRADE FROM STUDENTS WHERE GRADE = 8
UNION 
SELECT COUNT(*) AS student_count, GRADE FROM STUDENTS WHERE GRADE = 7
UNION
SELECT COUNT(*) AS student_count, GRADE FROM STUDENTS WHERE GRADE = 6;

Which did what I was looking for but I totally missed my mistake the first time and deleted it to do the UNIONS