1CREATE TABLE DemoT (
2 Personid int NOT NULL AUTO_INCREMENT,
3 LastName varchar(111) NOT NULL,
4 FirstName varchar(111),
5 Age int,
6 PRIMARY KEY (Personid)
7);
1ALTER TABLE `users` ADD `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY
2
3ALTER TABLE `users` ADD `id` INT NOT NULL AUTO_INCREMENT UNIQUE FIRST
4
1/* To insert into an auto incrementing field without specifing every column in
2the table, you can use the key word default in the place of the auto
3incrementing column*/
4
5INSERT INTO my_table VALUES(default, "test1", 222)
6/*VS */
7INSERT INTO my_table(name, num) VALUES("test1", 222)
8/*Having to type out all of the column names except the auto incrementing one
9can be very tedious when you have many columns, just use the keyword defualt
10instead and you only have to type it once.