[Music]
hello everyone
welcome to another video of sql guide
in this content i am going to discuss
how to fetch latest record from the
table in a sql database
sql query to get the latest record from
the table
let's connect with sql server management
studio to show you
how to get latest record from the table
in sql database
the table homemade resources imply i am
going to face a latest record from the
table human resources employee table in
this table you can see that business
entity id column and a higher date also
i am going to face the latest higher
date for the table human resources imply
or
so you have to go to
top one star from human resource
employee and order by
file date in deceiving you will get the
latest higher date
for the table home and resources imply
i have another method also to get the
latest record from the table
so i have table human resources
department i want a latest department
id from the table human resources
department
department id
department id from
human resources department type
table
so you will get the latest department id
you can see you receive the latest
department id but you need all the
column for the table right so in that
scenario you have to use where
department
id equal to you have
open bracket and close the bracket here
you will receive the latest department
id including all the columns
now i have another
method also to get the latest department
so i
so the table human resources department
order by department id decision i am
going to use offset
offset zero rows h first
one row only so this will take a latest
record and latest
record from the table homie resources
department you can see this is the
latest record which got inserted and
the table containing the latest record
is a department id 22 including this
column so this is the three way you can
receive the
latest record from the table this is the
first
this is the second and this is the
third method to get the and face the
latest
record from the table thanks for
watching sql guide please share and
subscribe my channel