我的印象是 float(n) 中 n 的最小值必须是 1。
我以前没有见过“float(0)”数据类型,所以我想知道它是否有效。
最佳答案
如果不指定实现,这个问题可能没有太大意义。
在 SQL Server 中,例如 float's minimum precision is 1 .
Where n is the number of bits that are used to store the mantissa of the float number in scientific notation and, therefore, dictates the precision and storage size. If n is specified, it must be a value between 1 and 53. The default value of n is 53.
另一方面,在 MySQL 中,float(0)
是有效的语法,但听起来意义不大。 From the specification :
MySQL also supports this optional precision specification, but the precision value is used only to determine storage size. A precision from 0 to 23 results in a four-byte single-precision FLOAT column. A precision from 24 to 53 results in an eight-byte double-precision DOUBLE column.
甲骨文 has a FLOAT datatype , 但它似乎只是 NUMBER 的别名,其最小精度为 1:
A subtype of the NUMBER datatype having precision p. A FLOAT value is represented internally as NUMBER. The precision p can range from 1 to 126 binary digits. A FLOAT value requires from 1 to 22 bytes.
因此您可以看到答案是高度特定于实现的。我不确定 ANSI SQL 标准是否指定了 FLOAT 精度。他们可能没有。
关于sql - float(0) SQL 数据类型有效吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5794255/