TOP and DISTINCT are two useful modifiers for the SELECT clause; TOP is great for reducing the number of rows in your output, and DISTINCT is great for getting rid of any duplicate data.
The dbfiddle website can be accessed for free and without an account at:
https://dbfiddle.uk/
Make sure to use the SQL Server dialect and the AdventureWorks sample database to be able to follow along with these examples!
---------------------------------------------------
This is part of the From Excel to SQL playlist, available at:
• From Excel to SQL
Check out the previous video at:
• From Excel to SQL - Comments (-- and /**/)
...and the next video at:
• From Excel to SQL - Data Types (CHAR, INT,...
The written version of this content is also available at:
https://billwallis.github.io/sql-lear...
---------------------------------------------------
CHAPTERS
00:00 dbfiddle
00:28 Intro
00:59 Using TOP
01:40 TOP with ORDER BY
02:33 TOP with WHERE
03:39 TOP in Excel
05:41 TOP vs LIMIT
06:37 Using DISTINCT
10:05 Using DISTINCT and TOP together
12:07 Wrap up