In SQL Server, you can sort the table by descending order using ORDER BY and use TOP 1 to get the top row from the sorted table. Here is the syntax to get the last record in SQL server:
SELECT TOP 1 ColumnName FROM TableName
ORDER BY ColumnName DESC;
In MySQL, you can sort the table by descending order using ORDER BY and use LIMIT 1 keyword to get the top row from the sorted table. Here is the syntax to get the last record in SQL server
SELECT ColumnName FROM TableName
ORDER BY ColumnName DESC
LIMIT 1;
If you are interested in SQL, then check out this SQL training course by Intellipaat that provides instructor-led training, self-paced videos, and hands-on experience.