什么是SQL Int(N)的大小? [英] Whats the size of an SQL Int(N)?
问题描述
简单的问题。我尝试在Google上搜索,经过大约6次搜索后,我认为它会更快。
Simple question. I have tried searching on Google and after about 6 searches, I figured it would be faster here.
SQL中的int有多大?
How big is an int in SQL?
// table creation statement.
intcolumn INT(N) NOT NULL,
// more table creation statement.
INT(N)
有多大>元件?它的范围是什么?它是2 ^ N还是N字节长? (2 ^ 8N)?或者甚至是其他我不知道的东西?
How big is that INT(N)
element? What's its range? Is it 2^N or is it N Bytes long? (2 ^ 8N)? Or even something else I have no idea about?
推荐答案
这取决于数据库。 MySQL有一个扩展名,其中INT(N)表示带有显示宽度的INT 4个十进制数字。此信息在元数据中维护。 INT本身仍然是4个字节,可以存储10000和更大的值(并且可能会显示,但这取决于应用程序如何使用结果集)。
It depends on the database. MySQL has an extension where INT(N) means an INT with a display width of 4 decimal digits. This information is maintained in the metadata. The INT itself is still 4 bytes, and values 10000 and greater can be stored (and probably displayed, but this depends how the application uses the result set).
这篇关于什么是SQL Int(N)的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!