Join Dan Sullivan for an in-depth discussion in this video FETCH FIRST to find top results, part of Advanced SQL for Data Scientists.
- [Narrator] When working with large data sets,…we're sometimes interested only in the top results,…based on some sort criteria.…For example, we might want to list the employees…with the top 10 salaries.…Let's see how easy it is to work with…the top results in SQL.…Now I'm going to build a select statement,…and let's select the last name, job title, and salary.…Let's pull this from the staff table,…and we want to know about salary and top salaries,…so we're going to order by salary,…and we want the top salary, so we want to start at the highest…so we'll use the descending, or DESC keyword.…
Now, what I'm going to do is add a clause called fetch first.…Now, fetch first works with the order by clause…to sort and limit results.…Fetch first is like the limit keyword,…in that only a fixed number of rows are returned,…but with fetch first, the ordering is performed…before choosing the rows to return.…So, I'll specify fetch first,…10 rows only, so this will return only 10 rows.…And as we'll see, there are 10 rows returned,…
The course begins with a brief overview of SQL. Then the five major topics a data scientist should understand when working with relational databases: basic statistics in SQL, data preparation in SQL, advanced filtering and data aggregation, window functions, and preparing data for use with analytics tools.
- Data manipulation
- ANSI standards
- SQL and variations
- Statistical functions in SQL
- String, numeric, and regular expression functions in SQL
- Advanced filtering techniques
- Advanced aggregation techniques
- Windowing functions for working with ordered data sets
Skill Level Advanced
SQL: Data Reporting and Analysiswith Emma Saunders2h 16m Intermediate
1. SQL as a Tool for Data Science
SQL data definition features5m 32s
2. Basic Statistics with SQL
3. Data Munging with SQL
4. Filtering, Joins, and Aggregation
5. Window Functions and Ordered Data
6. Preparing Data for Analytics Tools
- 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.