Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed SQL Reporting by Example!
You have completed SQL Reporting by Example!
Preview
Which students have last names starting with 'A'?
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
Finally for your last question,
0:00
we'd like you to figure out which
students have last names starting with A.
0:02
For this query,
we're getting back to the students table.
0:07
So let's start by selecting all of
the students, SELECT * FROM STUDENTS.
0:10
Then we need to add
a where clause to give us
0:16
only the students with last
names starting with A.
0:19
So let's add WHERE, and
then the last name column.
0:22
And all that's left is we need
to find a way to filter this
0:26
to only show the last
names starting with A.
0:28
To do this, we can use the LIKE keyword.
0:31
And we wanna show last names
that are like the following, A%.
0:35
And what this means, is that we're only
to going to get names that have the first
0:40
character as the capital A, and from
then on out, it can be whatever we want.
0:45
So, this query will give us only students
with last names starting with A.
0:51
So, let's add a semicolon and run it.
0:55
And there we go, a bunch of students
with last names starting with A.
0:59
So, for example, if we wanted to
show students with last names that
1:03
end with the letter E,
we could do % and then an E.
1:07
And let's see what happens
if we use a capital E.
1:12
It looks like it works.
1:16
Here's a bunch of students with
last names that end with E.
1:17
Pretty cool?
1:20
Awesome work.
1:23
From everything I can see,
it looks like you're really good at this,
1:24
though things always get a bit more
challenging once the school year begins.
1:28
In the next part of the course, we'll
practice joining between multiple tables
1:32
and tackle some more advanced reports,
1:36
like how many students the school can hold
and which teachers teach eighth grade.
1:38
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