column_name data_type(size) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

column_name data_type(size)

Maybe someone can explain this to me as I'm consistently seeing it in the examples. When a tables is being created in the examples as an integer (Int) type, I'm seeing the entry as column_name int, and no size is being referenced? In another example I saw the entry of id int not null auto_increment and when the table created was shown it displayed a size of int(11) for the column in the table? Where is this size coming from?

9th Nov 2016, 3:11 PM
Marc Statters
1 Answer
+ 1
int(11) is the default integer size for MySQL default settings databases (and maybe others) You can specify a size when creating or altering a table if you think an 11 digit integer is too much for the data you want to store as it can save you some disk space.
9th Nov 2016, 3:18 PM
Sleuvin S
Sleuvin S - avatar