如何使用MySQL十进制?
MySQL十进制数据类型可用于存储确切的数值。DECIMAL数据类型的语法。
yourColumnName Decimal(integerValue,intgerValue);
DECIMAL数据类型的示例。
mysql> create table EmployeeInformation -> ( -> EmpId int auto_increment primary key, -> EmpName varchar(200), -> EmpSalary DECIMAL(6.2) -> );
每当我们在“EmpSalary”列中插入一个大于6位数字的值时,都会引发错误。错误如下-
mysql> insert into EmployeeInformation(EmpName,EmpSalary) values('John',6999999.50);
ERROR 1264 (22003): Out of range value for column 'EmpSalary' at row 1在“EmpSalary”列中插入值,并带有确切的位数。
mysql> insert into EmployeeInformation(EmpName,EmpSalary) values('John',6999.50);
mysql> insert into EmployeeInformation(EmpName,EmpSalary) values('John',69999.50);显示所有记录。
mysql> select *from EmployeeInformation;
以下是输出。
+-------+---------+-----------+ | EmpId | EmpName | EmpSalary | +-------+---------+-----------+ | 1 | John | 7000 | | 2 | John | 70000 | +-------+---------+-----------+ 2 rows in set (0.00 sec)
热门推荐
1 狗狗下楼训练
3 狗狗训练头盔
6 狗狗训练机构
7 训练狗狗步骤
9 狗狗能训练
10 狗狗基本动作训练方法
11 怎么训练狗狗叼饭盆
12 狗狗一岁了还能训练吗
13 训练狗狗的
14 宁波狗狗训练
15 训练狗狗拉屎
16 教狗狗训练
17 狗狗要怎么训练上厕所
18 狗狗靠的训练