Just a Few Rows
LIMIT and comments.
The customers table has five hundred rows. Real company tables can have millions. If you select everything, your screen fills up with rows you'll never read. So we need a way to say, just show me a few.

- 500 customers
- Real tables have millions
- Just show me a few
LIMIT
Limit goes at the very end of the query. Limit three means, give me at most three rows. Run it. Three customers, and no flood. Use limit whenever you're exploring a table for the first time. It's quick, and it's polite to the database.
SELECT first_name, city
FROM customers
LIMIT 3;โโโโโโโโโโโโโโฌโโโโโโโโโโโโ โ first_name โ city โ โโโโโโโโโโโโโโผโโโโโโโโโโโโค โ Tara โ Toronto โ โ Grace โ Melbourne โ โ Finn โ Toronto โ โโโโโโโโโโโโโโดโโโโโโโโโโโโ
Notes for humans
You can also leave notes in your query. Two dashes start a comment, and SQL ignores everything after them, until the end of the line. A comment can sit on its own line, or at the end of a line. Run it. The comments don't change the answer at all. They're for you, and for the next person who reads your query.
-- Helen wants a quick look at her books
SELECT title, genre -- just two columns
FROM books
LIMIT 3;โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโ โ title โ genre โ โโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโค โ The Silent Orchard โ Mystery โ โ Code of the River โ Thriller โ โ Stars Over Lagos โ Romance โ โโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโ
List some customers
Your turn. Show the first name, last name, and country of the first five customers. Pause the video, and try it. Here's one way. Select the three columns, from customers, limit five.
Show first_name, last_name and country for 5 customers
Show hint
Three columns, one table, and LIMIT
Show solution
SELECT first_name, last_name, country
FROM customers
LIMIT 5;โโโโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโโ โ first_name โ last_name โ country โ โโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโโค โ Tara โ Brown โ Canada โ โ Grace โ Lopez โ Australia โ โ Finn โ Haddad โ Canada โ โ Daniel โ Ali โ UK โ โ Daniel โ Ali โ Australia โ โโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโ
Summary
You can now pick columns, limit rows, and leave comments. That's a real skill already. Next, the most useful word in SQL. Where. It lets you ask for only the rows you care about.
Key takeaways- LIMIT shows a few rows
- -- starts a comment
- Explore before you dig