【发布时间】:2020-06-16 20:29:59
【问题描述】:
下面是我的表结构,我想验证price_list_rate字段,值应该大于零,我试过无符号
Version information: 4.5.4.1deb2ubuntu2.1
CREATE TABLE `price_list` (
`price_list_id` int(11) NOT NULL,
`price_list_city_id` int(11) NOT NULL,
`price_list_process_id` int(11) NOT NULL,
`price_list_product_id` int(11) NOT NULL,
`price_list_rate` float UNSIGNED NOT NULL,
`price_list_vendor_rate` int(11) NOT NULL,
`created_by` int(10) UNSIGNED NOT NULL,
`created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updated_by` int(10) UNSIGNED NOT NULL,
`updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
【问题讨论】:
-
值得指出的是,对于价格列,float 不是合适的数据类型。十进制会更好。
-
哪个 MySQL 版本? stackoverflow.com/questions/2115497/…