TL;DR – By using SQL SELECT TOP, you can define the amount of data records to bring back. This command is very useful when working with significant amounts of data, but not universally supported.
Contents
The syntax for SQL SELECT TOP
In SQL Server / MS Access
Example
SELECT TOP number|percent column_name(s)
FROM name_table
WHERE condition;
In MySQL
Example
SELECT column_name(s)
FROM name_table
WHERE condition
LIMIT number;
In Oracle
Example
SELECT column_name(s)
FROM name_table
WHERE ROWNUM <= number;
Pros Main Features
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
Pros Main Features
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
Pros Main Features
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
Examples using a demo database
The Customers table
ID | Name | Contact | Address | City | Postal_Code | Country |
---|---|---|---|---|---|---|
1 | Ben Choplinks | Ben Choplink | Obeesre Str. 51 | Rome | 11207 | Italy |
2 | Donald Rich | Donald Richario | Avda. de la Confgfstitución 4122 | Tallin | 17021 | Estonia |
3 | Lilly Smilkins | Lilly Smilkin | Matadsderos 2312 | Eguero | 14023 | Mexico |
4 | Brandinina | Tom Hitchins | 110 Hanegover Sq. | London | WB2 2DP | UK |
5 | Carizmos | Christiano Kerrys | Berguvsesvägen 9 | Luleå | S-968 43 | Sweden |
Picking the first three data records
Example
SELECT TOP 3 * FROM Customers;
Picking the first half of the data records
Example
SELECT TOP 50 PERCENT * FROM Customers;
Picking the first three records that comply with a condition
Example
SELECT TOP 3 * FROM Customers
WHERE Country='Germany';