Finding the last five records from the table in SQL
Hello All,
Hope this post finds you in good health and spirit.
Structured Query Language, abbreviated as SQL, is a domain-specific language used in programming and designed for managing data held in a relational database management system, or for stream processing in a relational data stream management system.
An good developer must be familiar with a few commands in SQL because it is such a strong development tool. The SQL queries listed below are important for coding and optimization. Almost every system that interacts with a SQL database will be affected by each query in the SQL tutorial.
Finding the last five records from the table in SQL
Now, if you want to fetch the last eight records from the table then it is always difficult to get such data if your table contains huge information. For example, you want to get the last 8 records from the employee table then you can use rownum and a union clause. The rownum is temporary in SQL. For example,
Select * from Employee A where rownum <=8 union select * from (Select * from Employee A order by rowid desc) where rownum <=8;
The above SQL query will give you the last eight records from the employee table where rownum is a pseudo column. It indexes the data in an output set.
So, that’s all in this blog. I will meet you soon with next stuff .Have a nice day !!!
Recommended contents
- MYSQL Port
- Cluster Installation failed with error “Wait on the Database Engine recovery handle failed
- Backup SQL Server 2016 Databases using Powershell
- How to silently install SQL Server 2016 Standard
- How to Resolve SQL Database Error 8959
- Why table can have only one clustered index? No it is not what you think
- Starting with SQL Server
- How to install SQL Server 2017
Guys please don’t forget to like and share the post.Also join our WindowsTechno Community and where you can post your queries/doubts and our experts will address them .
You can also share the feedback on below windows techno email id.
If you have any questions feel free to contact us on admin@windowstechno.com also follow us on facebook@windowstechno to get updates about new blog posts.