Posts: 415
Threads: 145
Joined: Oct 2013
Reputation:
0
Why this guy used in tutorial to create this table but id with 10 length why? CREATE TABLE IF NOT EXISTS `players`(\ `ID` int(10) NOT NULL AUTO_INCREMENT
Posts: 1,733
Threads: 20
Joined: Nov 2010
Reputation:
0
If you use a program like Navicat, which allows you to connect to your databases and view your tables, you'll see that MySQL needs these values.
When designing the tables, you can input the column-name and datatype stored.
If you choose "integer", the column is created with size 11.
My MySQL package also has MySQL Workbench installed and I can ask that program to send the creation-query for any table to the output window.
This query is similar to the one you posted.
My guess is that integers are stored as text in the database-file and MySQL needs the size of that field to be able to index the tables properly.
Any unsigned integer is stored using 10 characters.
Those can go from 0 to little over 4 billion, and 4 billion written as text is 10 characters.
Unsigned integers range from little over -2 billion to little over 2 billion.
The negative sign also needs a character slot, so signed integers take 11 characters to be stored.
My scripts use "int(11)" in those queries.
Posts: 415
Threads: 145
Joined: Oct 2013
Reputation:
0
Yeah, when I left it empty it automaticaly set INT(11)