Reputation: 1577
What is the difference between int and integer datatypes in MySQL 5.0? Can anyone help? I don't understand the exact difference.
Upvotes: 43
Views: 49534
Reputation: 62466
According to the MySQL documentation :
The keyword INT is a synonym for INTEGER
but if you want to write SQL scripts compatible with ANSI SQL use INTEGER
. According to the specification :
SQL defines distinct data types named by the following keywords: CHARACTER, CHARACTER VARYING, BIT, BIT VARYING, NUMERIC, DECIMAL, INTEGER, SMALLINT, FLOAT, REAL, DOUBLE PRECISION, DATE, TIME, TIMESTAMP, and INTERVAL.
In this way, you will have better chance to use your SQL scripts on other DBMS. For example PostgresSQL have an INTEGER
type but no INT
type.
Upvotes: 14
Reputation: 37
The difference between int
and integer is that int
is a data type, but integer is a group of data types – e.g. int
, long
, short
and byte
.
Upvotes: 2
Reputation: 17096
I guess the only difference is the spelling.
So by using INT, you'd end up using less bytes on your SQL script (not that it matters).
Upvotes: 16
Reputation: 3094
Taken from MYSQL 5.0 online reference
The keyword INT is a synonym for INTEGER.
Upvotes: 63