HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

How does MySQL Workbench decide what number to put in parentheses after a datatype?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
afternumberparenthesesworkbenchwhatdatatypeputmysqldecidedoes

Problem

I create columns in MySQL Workbench and it often puts different numbers in parentheses after datatype, e.g. I input this:

Column Name          Datatype:
id                   INT
account_parameters   INT
accounts             TINYINT
account_properties   TINYINT


and after executing the query I get

Column Name          Datatype:
id                   INT(10)
account_parameters   INT(11)
accounts             TINYINT(1)
account_properties   TINYINT(2)


Why does it do it? Is there a reason why one should be INT(11), while others are INT(10)?

Solution

In this case, the difference is likely due to the int and tinyint being signed (default) or unsigned in their definitions. Note that the numbers in the parentheses are largely irrelevant for most applications (they define a display width).

Context

StackExchange Database Administrators Q#177951, answer score: 3

Revisions (0)

No revisions yet.