Explains how to sort query results in ascending or descending order
- [Instructor] Earlier we ran this query,…and it returned us all the Penelopes there.…So it's giving us all the actors…with the first name of Penelope…but the last names seem to be…in quite a random order.…They're certainly not alphabetical.…We've got G and then P, and then C and then M.…In fact, what's happening is…that they're given to us in the same order…they appear in the table.…Rows in a table are typically…in the order they were entered.…So data entered later is lower down in the table…so Penelope Monroe was probably inserted…into the actor table after…all of these three before it.…
So this is no good to us.…We've just decided that we don't care…when the name was added to the database.…We want to sort our results alphabetically on last name.…And to do this we use a new command…which is order by.…And we'll say order by last name,…and run that.…By default, when you use order by,…the results are arranged in ascending order.…
The database doesn't care, by the way,…whether this is in a number or a date.…It identifies what kind of data it's dealing with,…
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.