【发布时间】:2017-02-27 12:41:31
【问题描述】:
我想在我的数据库中存储 1 个小数点后 4 个数字。
如果我使用 float 我只能添加 2 位小数
$table->float('sell');
如果我尝试使用 十进制,我会收到错误
$table->decimal('sell', 1, 4);
第一个数字必须大于或等于第二个数字。
SQLSTATE[42000]: Syntax error or access violation: 1427 For float(M,D), double(M,D) or decimal(M,D), M must be >= D (column '
卖出')。 (SQL: create table customers (id int unsigned not null auto_increment 主键, sell decimal(1, 4) not null,created_at timestamp null, updated_at timestamp null) 默认字符集utf8 整理 utf8_unicode_ci)
有什么帮助吗?
谢谢
【问题讨论】:
标签: sql laravel laravel-5 eloquent laravel-5.2