sql - float(0) SQL 数据类型有效吗?

标签 sql

我的印象是 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/

相关文章:

sql - 在 Doctrine 2 中做一个 WHERE .. IN 子查询

c# - 在 C# 中安全地生成 SQL 查询

mysql - 喜欢...而不是...sql

具有相同列名的 MySQL 连接表

sql - T-SQL 使用变量从 xml 中检索 sql 属性

MySql 根据两列从数据库中提取数据

sql - ORA-00934 : group function is not allowed here 00934. 00000 - "group function is not allowed here"

INSERT 语句中的 java.sql.SQLSyntaxError

sql - 用于 BETWEEN 的日期列上的非聚集索引

sql - PostgreSQL 通过 GROUP BY 删除重复项