today lecture i'm going to discuss about
how to limit number of rows on oracle
database table
so here i'm using the employees table so
first i'm going to show you the records
inside the employees table
so let's click ok
then you can see this is the record
inside the employees
and total 107 rows are there
so here you can see there i'm using the
terms called row now so this is now one
two three four five six seven eight this
all are row now
so these are automatically generated
now
with the help of this
ronum we can easily do the limit
of the rows so if you want to or display
top five rows so here you need to give
the
condition 5
and if you want to display the top 5
saturday
so now if i execute this inner query
so this inner query that returned
so here you can see desc that means
started descending that means highest to
lowest
so if i execute this query
then you can see this is 2 4
24 000 is the highest rd next is 17 000
next is 17 next is 14 000.
so here according to this one
according to satisfied if you want to
display the top five rows
so you need to execute or this query
okay so wait one second
so let's so select that and
run so now you can see top
five saturday
okay 24 000 next is 70 000 for the nina
and 17 000 for the blacks
40 000 john and
13 500 karen okay
so now if you want then you can here
limit the rows so if you want to see the
only top 10 side device rows so you can
or just execute that
so now you can see top date
or employees with the sad device okay so
this all implies has the top 10 survey
so you are not only if you want to
display so this is the tables now if you
want user one top ten
employees into the list okay so this is
first second third is
employees so simple you know need to
give here
or just
so order wise
no need to give because this is already
in ascending order so if you execute
this query so this select all the
employees and there this provides the
row now
if i execute that so now you can see top
10 employees okay
but if you want to
or here
or from the bottom so
for this you need to use here
employee id
employee underscore id
so you need to give your de sa
so this is now
so this is not descending order so if i
execute this query
so
here
i
need to
include order by
order right then that's fine so order by
employee id display so
from the
or bottoms if you want to display the
top
or 10 employee from the bottom so you
can use this kitty so now you can see
this all 206 205 and 197 so this is the
employees that display displaying from
the bottom
okay
so this is the so easiest way we can
here display the top 10
employees
from the bottom and from the top
and if you want to include with the
study
wise
so you need to give here in place of
employee id and you need to put
salary
so from the highest to lowest that to go
fast
and according to that that display so
this is now
and from the lowest if you want then
or for this one a
asc
you need to ascending wise so that means
our lowest salary from here implies you
can see
so here the lowest salary of
implies t is a 2100 22
for steven and hazard okay
so this is how we can do the limit of
the rows with the help of low numb we
can easily do that
so this question that asks so many times
by the interview so you should
uh
know that so i hope guys this video is
the help for you so now in this video
it's over so thanks for watching see
next week thank you