Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
How many students do they have at Jefferson Middle School?
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Not bad.
0:00
How about this?
0:01
How many total students are at the school?
0:02
For this report,
we'll need to be using the students table,
0:06
and we'll need to be selecting
a count of all the students.
0:08
And to do that, we'll type SELECT,
then COUNT, and
0:13
usually you'll COUNT(*),
and then FROM STUDENTS.
0:17
Then we can run the query and
we have 512 students.
0:23
Another interesting thing to
mention is this star here.
0:26
When you're doing a count over a table,
it's perfectly fine to count everything,
0:30
but it's also perfectly
fine to just count 1.
0:35
And so, if we use Shift+Enter here,
we get the same answer.
0:38
Now using 1 or
* doesn't really make any difference,
0:42
just know that you can use either or.
0:45
You could even use a 10,
or even a column name.
0:48
So STUDENTS.FIRST_NAME and
we'll always get the same count.
0:53
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up