由于接受的答案让我感到匮乏,因此我在一个表上运行,该表包含定义为的几列(请注意缺少M和D的值。SHOW CREATE TABLE
DECIMAL DEFAULT NULL
结果如下。
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值。