Jose: Hi guys and welcome back.
In this video we're going to learn about
limiting the number of results we get back when selecting
using the limit keyword.
We can get, for example, the 10 most experienced employees
using order by and limit as in this example.
Select star from employees;
order by years experience in descending order
so the highest ones are at the top;
limit 10 just gives us 10 rows or up to 10 rows.
If there's fewer than 10 rows then we will get that number.
Without the order by it's not so useful.
You can just get the 10 first rows
that were added to table matching the constraint.
So here, you're getting select star from employees;
where the salary is greater than 100,000; limit 10.
You're just getting the 10 first employees
that were added to the table with that salary.
Or just the first 10 rows
if you don't include a where clause at all.
Pretty useless in most cases.
Select star from employees limit 10,
just gonna give you the first 10 rows
added to the table, period.
The limit keyword pretty easy to use as you can see.
Just gives you up to a number of rows.
Thank you guys for watching this video,
I'll see you in the next one.