mysql create的几种用法和将字段设为插入时间
DROP TABLE IF EXISTS basic_info; CREATE TABLE basic_info ( id INT(11) NOT NULL auto_increment, name VARCHAR(20), c_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '插入时间', PRIMARY KEY(id) );
其他用法:
DROP TABLE IF EXISTS basic_info; CREATE TABLE basic_info ( u_id INT(11) NOT NULL auto_increment, u_name VARCHAR(20), c_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '插入时间', PRIMARY KEY(u_id) )ENGINE=INNODB DEFAULT CHARSET=utf8; CREATE TABLE user_info LIKE basic_info; CREATE TABLE person_info AS SELECT u_name, c_time FROM user_info;