由于接受的答案让我想要,我SHOW CREATE TABLE
在一个包含几个定义为的列的表上运行DECIMAL DEFAULT NULL
(注意没有M和D的值。
结果如下。
data_warehouse as davidg Wed Dec 05 12:10:36 2018 >SHOW CREATE TABLE erth_calendarmonths_historic_usage_preload;
+--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| erth_calendarmonths_historic_usage_preload | CREATE TABLE `erth_calendarmonths_historic_usage_preload` (
`market` varchar(100) NOT NULL,
`commodity` varchar(100) NOT NULL,
`account_number` varchar(100) NOT NULL,
`meter_number` varchar(100) NOT NULL,
`period_year_month` int(11) NOT NULL,
`estimated_usage_amount` decimal(18,7) DEFAULT NULL,
`unit` varchar(100) DEFAULT NULL,
`meter_read_start_date_part_1` datetime DEFAULT NULL,
`meter_read_end_date_part_1` datetime DEFAULT NULL,
`gross_nonadjusted_usage_amount_part_1` decimal(10,0) DEFAULT NULL,
`applied_nonadjusted_usage_amount_part_1` decimal(10,0) DEFAULT NULL,
`meter_read_start_date_part_2` datetime DEFAULT NULL,
`meter_read_end_date_part_2` datetime DEFAULT NULL,
`gross_nonadjusted_usage_amount_part_2` decimal(10,0) DEFAULT NULL,
`applied_nonadjusted_usage_amount_part_2` decimal(10,0) DEFAULT NULL,
`utility_rate_class` varchar(100) DEFAULT NULL,
`utility_rate_subclass` varchar(100) DEFAULT NULL,
`load_profile` varchar(100) DEFAULT NULL,
`hu_type` varchar(100) DEFAULT NULL,
`type` varchar(100) DEFAULT NULL,
`utility_duns` varchar(100) DEFAULT NULL,
`create_date` datetime DEFAULT NULL,
`update_date` datetime DEFAULT NULL,
`UsedBuckets` tinyint(4) NOT NULL DEFAULT '0',
PRIMARY KEY (`market`,`commodity`,`account_number`,`meter_number`,`period_year_month`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
+--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
上述使M和D的默认值不言而喻;M = 10,而D = 0。不用说,这几乎肯定不是预期的结果。
您应始终指定您的 M 和 D 值。