给时间戳字段用不同的缺省值

[code="java"

SET NAMES utf8;

-- ----------------------------
-- Table structure for `test`
-- ----------------------------
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Table structure for `test_char`
-- ----------------------------
DROP TABLE IF EXISTS `test_char`;
CREATE TABLE `test_char` (
`id` int(11) NOT NULL,
`name_1` char(20) DEFAULT NULL,
`name_2` char(20) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `ind_name` (`name_1`,`name_2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- ----------------------------
-- Table structure for `testff`
-- ----------------------------
DROP TABLE IF EXISTS `testff`;
CREATE TABLE `testff` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`yantime` timestamp NULL DEFAULT '2016-03-10 16:55:20',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2

-- ----------------------------
-- Table structure for `testint`
-- ----------------------------
DROP TABLE IF EXISTS `testint`;
CREATE TABLE `testint` (
`id` int(6) NOT NULL DEFAULT '0',
`testid` int(18) DEFAULT NULL,
`eee` decimal(10,0) DEFAULT NULL,
`timestamp1` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB

[/code]

你可能感兴趣的:(MYSQL,java)