Since the accepted answer left me wanting, I ran SHOW CREATE TABLE
on a table that contains several columns defined as DECIMAL DEFAULT NULL
(note the absence of values for M and D.
The result follows.
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 |
+--------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
The foregoing makes the default values of M and D self-evident; M = 10, while D = 0. Needless to say, this is almost certainly not the desired outcome.
Thou shalt always specify thine M and D values.