Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Listing Teachers1:08 with Ben Deitch
Generate a list of teachers sorted alphabetically.
For your penultimate practice problem, we'd like you to generate a list of
all of the teachers sorted alphabetically by last name.
Also, we'd like to only see the first and last names of each teacher.
For this question,
we wanna get a list of all the teachers sorted alphabetically by last name.
And we only wanna show the first and last names.
So first, let's check out the teacher's table to see what those columns are named.
Okay, it looks like, just like the student's table,
it's named first name, and last name.
So, back in the query, let's select FIRST_NAME and
LAST_NAME from the teachers table.
And then, to sort them alphabetically, let's add an order by.
Then we need to say what we wanna sort them alphabetically by, so
the last name column, and what order we'd like to use.
So let's use ASC to represent ascending, which will give us from A to Z.
Then if we run the query, there we go.
All the teachers ordered alphabetically by last name.
You need to sign up for Treehouse in order to download course files.Sign up