Sometimes we need to find the last inserted record into table. We can do this by using ORDER by and LIMIT.
Syntax:
SELECT *
FROM table_name
ORDER by id DESC
LIMIT 1;
Example: Suppose we have a table named "tickit" and we want to find the last inserted record into the table, then use the below query:
SELECT *
FROM tickit
ORDER by id DESC
LIMIT 1;
the above statement will return the last entered record.
Hope this will help you :)
0 Comment(s)