Explains an alternative method to retrieve data from more than one table, using nested queries or subqueries, and explains when this is a reasonable option
- [Narrator] We've seen this sort of SELECT statement…countless times now.…Now we're going to look at something…that is actually equivalent…but certainly looks a bit different.…And we say SELECT f.first_name from,…and then we're going to write a subquery in brackets.…And we say (SELECT first_name from actor).…And we call that whole result set,…we give it an alias of f.…
Now that's returned us the same 200 rows.…Now obviously, this is a contrived example,…and you would generally just use…this smaller query in preference,…but the syntax is useful.…So let's look at what's going on here.…If you come across this sort of query,…you should always make sense of it…from the inside out.…And when I say inside, I mean start off by looking…at anything in parentheses.…So what this is doing,…it's selecting the first_name field from actor,…and that result set is being given an alias of f.…
And then we're selecting first_name from the result set.…It's similar in some ways to the IN syntax…that we saw in the last video.…If we didn't use the alias here,…
Join Emma Saunders as she shows you how to design and write simple SQL queries for data reporting and analysis. Review the different types of SQL, and then learn how to filter, group, and sort data, using built-in SQL functions to format or calculate results. Learn a bit about data types and database design. Discover how to perform more complex queries, such as joining data together from different database tables. Last but not least, Emma shows how to save your queries as views, so you can run them again and again.
- Using different versions of SQL
- Retrieving data with SELECT statements
- Filtering and sorting your results
- Transforming results with built-in SQL functions
- Grouping SQL results
- Merging data from multiple tables
- Identifying data types, and how to make sense of your database design
- Saving SQL queries
Skill Level Intermediate
1. Use SQL to Report Data
Data types in SQL databases5m 47s
2. Group your SQL Results
3. Merge Data from Multiple Tables
4. Advanced Features and Taking Your Learning Forwards
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
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.