How to specify decimal precision and scale number in MySQL using phpMyAdmin(如何使用 phpMyAdmin 在 MySQL 中指定小数精度和小数位数)
问题描述
SQL 使 MySQL 用户能够分配具有特定精度和比例数字的十进制格式的文件:
SQL enables MySQL users to allocate a filed in Decimal format with specific Precision and Scale numbers as:
CREATE TABLE test_table
(
test_column DECIMAL(6,4) NOT NULL
);
如何在 phpMyAdmin 中执行此操作,因为字段类型只有长度/值选项可用?
How can I do this in phpMyAdmin as the field type has only length/value option available there?
推荐答案
可以使用 DECIMAL(M,D) 数据类型将小数添加到 MySQL 数据库中.这需要 2 个参数.
Decimals can be added to a MySQL database by using the DECIMAL(M,D) data type. This requires 2 arguments.
- M 是最大位数,范围从 1 到 65.
- D 是可用的小数位数,范围从 0 到 30.
请注意,D 位保留为小数位,因此整数部分最多可以有 M-D 位可用.因此,如果我们使用 DECIMAL(6,4),数字 45.8239 将有效,但 456.12 无效.
Note that with D digits reserved for decimal places, there can be at most M-D digits available for the integer part. So if we use DECIMAL(6,4), the number 45.8239 would be valid, but 456.12 would not.
要在 phpMyAdmin 中使用它,您可以执行以下操作:
To use this in phpMyAdmin, you can do the following:
在 Length/Value 字段中输入 6,4 不带括号.
In the Length/Value field type 6,4 without the parentheses.
产生如下表结构:
这篇关于如何使用 phpMyAdmin 在 MySQL 中指定小数精度和小数位数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 phpMyAdmin 在 MySQL 中指定小数精度和小数位数
基础教程推荐
- 在多列上分布任意行 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
