当前位置:网站首页>MySQL reported an error datetime (0) null

MySQL reported an error datetime (0) null

2022-07-06 04:30:00 Dreamy blue

[SQL] 
CREATE TABLE `t_order`  (
  `order_id` int(11) NOT NULL AUTO_INCREMENT COMMENT ' Waybill id',
  `order_no` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' Waybill No. ',
  `send_date` datetime(0) NULL DEFAULT NULL COMMENT ' Delivery time ',
  `arrive_date` datetime(0) NULL DEFAULT NULL COMMENT ' Arrival time ',
  `send_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' Shipping address ',
  `arrive_address` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' Shipping address ',
  `order_state` int(11) NULL DEFAULT 0 COMMENT '0 It is to be verified  1 Is in transit  2 Yes, it has arrived  3 It's order completion ',
  `order_create_date` datetime(0) NULL DEFAULT NULL COMMENT ' Order creation time ',
  `order_money` double NULL DEFAULT NULL COMMENT ' The freight ',
  `order_customer` int(11) NULL DEFAULT NULL COMMENT ' Order customers ',
  `order_arrive_username` varchar(11) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' Name of consignee ',
  `order_arrive_usertel` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT ' Consignee's telephone number ',
  `order_driver` int(11) NULL DEFAULT NULL COMMENT ' Transporters id',
  `order_tran` int(11) NULL DEFAULT NULL COMMENT ' Means of transport id',
  PRIMARY KEY (`order_id`) USING BTREE,
  INDEX `order_customer`(`order_customer`) USING BTREE,
  INDEX `order_driver`(`order_driver`) USING BTREE,
  INDEX `order_tran`(`order_tran`) USING BTREE,
  CONSTRAINT `t_order_ibfk_1` FOREIGN KEY (`order_customer`) REFERENCES `t_customer` (`customer_id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `t_order_ibfk_2` FOREIGN KEY (`order_driver`) REFERENCES `t_driver` (`driver_id`) ON DELETE CASCADE ON UPDATE RESTRICT,
  CONSTRAINT `t_order_ibfk_3` FOREIGN KEY (`order_tran`) REFERENCES `t_tran` (`tran_id`) ON DELETE CASCADE ON UPDATE RESTRICT
) ENGINE = InnoDB AUTO_INCREMENT = 27 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NULL DEFAULT NULL COMMENT ' Delivery time ', `arrive_date` datetime(0) NULL ' at line 4

Focus on this sentence
arrive_date datetime(0) NULL ’ at line 4

mysql Will prompt grammatical errors , as a result of datetime The length cannot be set to 0

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(0) NULL DEFAULT NULL,

terms of settlement

datetime(0)  Change it to  datetime 
原网站

版权声明
本文为[Dreamy blue]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132219483193.html