Payel Senapati
Payel Senapati

Reputation: 1356

In MySQL is there any difference when INT data type is explicitly stated to be UNSIGNED and when it is not?

In MySQL I can declare a table as -

CREATE TABLE table1 ( column1 INT );

I can also declare a table as -

CREATE TABLE table2 ( column2 INT SIGNED );

So is there any difference between the two tables or are they same?

Upvotes: 0

Views: 39

Answers (1)

FanoFN
FanoFN

Reputation: 7114

Extracted from MySQL official documentation about Numeric type syntax:

"Numeric data types that permit the UNSIGNED attribute also permit SIGNED. However, these data types are signed by default, so the SIGNED attribute has no effect."

Therefore both columns in your example above have the same datatype of INT SIGNED. Unless you're defining one of it as UNSIGNED, then there's a difference.

Upvotes: 1

Related Questions