SSH执行向数据库插入数据时 遇到自增的ID提示一定要填写 但自己在数据库操作的时候不需要填写 为什么 怎样设置ID 在代码中实现插入数据不需要填写ID ID是主键
天蓬老师2017-04-17 18:01:26
When you create the table, set the primary key to auto-increment. As follows:
CREATE TABLE `order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=177940 DEFAULT CHARSET=utf8 COMMENT='工单主表';
AUTO_INCREMENT above is to set the primary key to auto-increment mode.