This is my code:
CREATE TABLE table(
id int(1) UNIQUE,
name varchar(128) NOT NULL)
ALTER TABLE table ADD UNIQUE KEY id (id);
I'm not sure if I need the second statement or not, but either way it doesn't work when inserting INSERT INTO table( name ) VALUES( "test" ). It says table.id may not be NULL. What do I need to do to make it work with NULL(and Auto Increment?) Replacing the first column with id int(1) NOT NULL AUTO_INCREMENT,
makes it say syntax error.
Aucun commentaire:
Enregistrer un commentaire