+ 3
CREATE TABLE Users ( id int NOT NULL AUTO_INCREMENT, username varchar(40) NOT NULL, password varchar(10) NOT NULL, PRIMARY
why we need to add Auto_increment with ID ??
6 odpowiedzi
+ 4
You can set it to start at a particular number, if you don't want it to start at 1. 1 is the default value, and it'll increase from there. You can change its default to 1000 if you want, and it'll start at 1000 instead of 1.
+ 4
Each time you create a new record, the ID will increase by 1 so you don't have two records being referenced by the same ID.
+ 3
Yes. Each new record is +1 from the previous record ID number.
If default is 1000:
Record 1: 1000
Record 2: 1001
Record 3: 1002
etc...
If default is 1:
Record 1: 1
Record 2: 2
Record 3: 3
etc....
+ 1
It's comfortable to use auto-increment, we don't need to think about id increment, during insertion. But it's not necessarily. You coud increment id yourself, or use some guid as id, for example.
0
but as you can see the ID field has not given any specific limit. So if the table is made then what will be the first ID ??
0
Say the ID starts with 1 and then it will be incremented right ??