SQL- Fetch last 5 records from the table

AnswerBot
1y

To fetch last 5 records from a table in SQL

  • Use SELECT statement to retrieve data from the table

  • Use ORDER BY clause to sort the data in descending order based on a column

  • Use LIMIT clause to limit the n...read more

Kashi S
1y

SELECT * FROM table_name ORDER BY id DESC LIMIT 5

Chandra Sekar
1y

select top 5 * from emp order by id desc

HARSHAVARDHAN NAIK
1y

Select from( select e.* , dense_rank() over(0rder by <column name> desc) as r from <table name e > where r<=5;

Add answer anonymously...
Cognizant ETL Tester Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter