Is there a way to fetch the first entry of a table in database using SQL query?

后端 未结 2 1958
北海茫月
北海茫月 2021-01-13 20:30

I have a database table which stores names of people, i want to fetch the first entry of my database table. Is it possible using SQL query?

2条回答
  •  庸人自扰
    2021-01-13 21:10

    Use the following:

    SELECT * FROM names LIMIT 1
    

    And if you want the first sorted entry, then use the following:

    SELECT n.* FROM names n ORDER BY n.last_name ASC, n.first_name ASC LIMIT 1
    

提交回复
热议问题