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 0:00 all of the teachers sorted alphabetically by last name. 0:04 Also, we'd like to only see the first and last names of each teacher. 0:07 For this question, 0:13 we wanna get a list of all the teachers sorted alphabetically by last name. 0:14 And we only wanna show the first and last names. 0:18 So first, let's check out the teacher's table to see what those columns are named. 0:21 Okay, it looks like, just like the student's table, 0:26 it's named first name, and last name. 0:29 So, back in the query, let's select FIRST_NAME and 0:32 LAST_NAME from the teachers table. 0:38 And then, to sort them alphabetically, let's add an order by. 0:42 Then we need to say what we wanna sort them alphabetically by, so 0:45 the last name column, and what order we'd like to use. 0:50 So let's use ASC to represent ascending, which will give us from A to Z. 0:55 Then if we run the query, there we go. 1:01 All the teachers ordered alphabetically by last name. 1:05
You need to sign up for Treehouse in order to download course files.Sign up