简体   繁体   English

MySQL 5.0中int和integer有什么区别?

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

What is the difference between int and integer datatypes in MySQL 5.0? MySQL 5.0中的int和integer数据类型有什么区别? Can anyone help? 有人可以帮忙吗? I don't understand the exact difference. 我不明白确切的区别。

Taken from MYSQL 5.0 online reference 取自MYSQL 5.0在线参考

The keyword INT is a synonym for INTEGER. 关键字INT是INTEGER的同义词。

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). 因此,通过使用INT,您最终会在SQL脚本上使用更少的字节(并不重要)。

According to the MySQL documentation : 根据MySQL 文档

The keyword INT is a synonym for INTEGER 关键字INT是INTEGER的同义词

but if you want to write SQL scripts compatible with ANSI SQL use INTEGER . 但是如果要编写与ANSI SQL兼容的SQL脚本,请使用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. SQL定义了由以下关键字命名的不同数据类型:CHARACTER,CHARACTER VARYING,BIT,BIT VARYING,NUMERIC,DECIMAL, INTEGER ,SMALLINT,FLOAT,REAL,DOUBLE PRECISION,DATE,TIME,TIMESTAMP和INTERVAL。

In this way, you will have better chance to use your SQL scripts on other DBMS. 这样,您将有更好的机会在其他DBMS上使用SQL脚本。 For example PostgresSQL have an INTEGER type but no INT type. 例如, PostgresSQL具有INTEGER类型但没有INT类型。

之间的差int和整数是int是一种数据类型,但整数是一组数据类型-例如intlongshortbyte

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM