mysql - SQL Query Primary Key constraint -
i newbie in sql. can please enlighten me on following sql query. problem lies in staffid int not null auto_increment, primary key(personid)
$sql = "create table persons(staffid int not null auto_increment, primary key(personid),firstname varchar(15),lastname varchar(15),age int)";
thank you. regards.
you trying create primary key of invalid column, omitting auto increment column. please try below sql. see documentation mysql
create table persons(staffid int auto_increment, personid varchar(10), firstname varchar(15), lastname varchar(15), age int, primary key (staffid,personid));
Comments
Post a Comment