+ 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?
1 Resposta
+ 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.