|
|
| MYSQL |
Expert:JASINTHA
how to select last row in table?(MYSQL databse)
|
| Answers |
How to select last row of the table in mySql
Here is the query given below selects tha last row of the table in mySql database.
SELECT * FROM stu_info ORDER BY ID DESC LIMIT 1;
The table structure that has used in this sql query.....
CREATE TABLE `stu_info` ( `ID` int(11) NOT NULL auto_increment, `Name` varchar(20) default NULL, `Phone` varchar(15) default NULL, `City` varchar(20) default NULL, PRIMARY KEY (`ID`) ) In this table 'Id' is primary key. This query first arrange ID in descending order then find first one row from the table. 'Limit' keyword is used to select first rows from tha table for example.... limit 2 is used to select first two rows of the table.
|
| More Questions |
|
|
Post Answers
Ask Question
Facing Programming Problem?
|
|
|
|
|