Select specific row from mysql table

前端 未结 6 578
忘掉有多难
忘掉有多难 2020-12-07 23:08

Ideally I need a query that is equivalent to

select * from customer where row_number() = 3

but that\'s illegal.

I can\'t u

6条回答
  •  既然无缘
    2020-12-07 23:21

    Your table will need to be created with a unique ID field that will ideally have the AUTO_INCREMENT attribute. example:

    CREATE TABLE Persons
    (
    P_Id int NOT NULL AUTO_INCREMENT,
    LastName varchar(255) NOT NULL,
    FirstName varchar(255),
    PRIMARY KEY (P_Id)
    )
    

    Then you can access the 3rd record in this table with:

    SELECT * FROM Persons WHERE P_Id = 3
    

提交回复
热议问题