mysql - SQL create next numerical number automatically -
i want insert data table want each entry have id not taken.
for example:
insert table_lol (id, name, email, phone, address) values (1, bob, boblol@example.com, 1111111, 123 lollane);
i add where not exists
prevents id being overwritten. don't want user have make id, want generate next number user can't mess up.
is possible do? thanks!
use auto_increment when create table ex:
create table animals ( id mediumint not null auto_increment, name char(30) not null, primary key (id) );
then don't write value want id ex:
insert table_lol (name, email, phone, address) values (bob, boblol@example.com, 1111111, 123 lollane);
Comments
Post a Comment