Learn how a subselect can be used anywhere you would use a table, because the result of a SELECT is effectively another table itself.
- [Narrator] In this example, I'll show you a more practical…example of using a sub-select to provide a list of rows to…search for in a table.…We'll be using the album database for this.…And suppose you want a list of albums that have tracks…with a duration of 90 seconds or less.…I can select distinct album ID…from track, where duration is less than or equal to 90.…
And this will give me a list of the album ID's where…there is a track with a duration of less than or equal to…90 seconds.…Now you can use that select as a data source to search…the album table like this.…I'm going to put this all in parentheses, and…I'm going to say, select asterisk from album,…and I'll put this on another line.…I'll say, where ID in.…Remember I have a list of things,…so I can use the in operator.…
And I'll just put the semi-colon…down here and when I press go, I now have the list of album…titles, or album rows, from the album table where the ID was…in the list we got from the select distinct.…This is a very simple example.…You can use this technique with a joint query to get full…
- Understanding SQL terminology and syntax
- Creating new tables
- Inserting and updating data
- Writing basic SQL queries
- Sorting and filtering
- Accessing related tables with JOIN
- Working with strings
- Understanding numeric types
- Using aggregate functions and transactions
- Automating data with triggers
- Creating views
- Defining functions in PHP
Skill Level Beginner
2. SQL Overview
3. Fundamental Concepts
7. Dates and Times
Dates and times1m 52s
11. Views and Subselects
12. Defined Functions
13. A Simple CRUD Application
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.