Students by Grade1:32 with Ben Deitch
How many students are in each grade? And how many 6th graders do you think they'll have next year?
Perfect, that`s just what they were looking for. 0:00 Also, usually you'd get to go home early on your second day. 0:02 But unfortunately they just got a call from the fire department and 0:06 they`re worried about the school`s capacity numbers. 0:09 They`re fine for this year but 0:11 the fire department thinks it`s possible there will be too many students next year. 0:13 Could you find out how many students are in each grade? 0:18 And then use that data to predict how many sixth graders they'll have next year? 0:20 To figure out how many students are in each grade, 0:25 we'll need to use our first GROUP BY clause. 0:28 So let's start by selecting everything from STUDENTS. 0:30 And luckily we've got a GRADE column. 0:37 So let's GROUP BY GRADE. 0:39 And let's change from selecting everything to counting what we 0:43 get in the results as well as telling us which grade is selected. 0:48 So let's do GRADE, COUNT1), or COUNT(*) or whatever count you feel like using. 0:53 And if we run this, there we go. 0:57 So now we need to figure out how many sixth graders they'll have next year. 1:01 Okay, so from grade 8 to 7, it looks like this goes up 24 students. 1:04 And then from 7 to 6, that's 27 students. 1:11 So 24 to 27. 1:18 And then maybe the next sixth graders will be plus 30, so 1:21 let's say that the next sixth grade class is probably gonna have about 220 students. 1:25
You need to sign up for Treehouse in order to download course files.Sign up