What is the difference between int and integer in MySQL 5.0?

39,225

Solution 1

Taken from MYSQL 5.0 online reference

The keyword INT is a synonym for INTEGER.

Solution 2

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).

Solution 3

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.

Solution 4

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.

Share:
39,225
sivakumar
Author by

sivakumar

Updated on July 19, 2022

Comments

  • sivakumar
    sivakumar almost 2 years

    What is the difference between int and integer datatypes in MySQL 5.0? Can anyone help? I don't understand the exact difference.