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!
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
Noah Fields13,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.
Ben DeitchTreehouse Teacher
D'oh! Thanks for keeping me honest! It looks like we'll be making an update to this video in the near future :)
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