MySQL创建表
-- create DATABASE test
use test;
DROP TABLE if EXISTS zones;
CREATE TABLE zones
(
z_id INT PRIMARY KEY auto_increment,
z_name VARCHAR(50) NOT NULL
)ENGINE = INNODB;
DROP TABLE IF EXISTS user_info;
CREATE TABLE user_info
(
`user_id` INT,
`email` VARCHAR(50),
`pwd` VARCHAR(50) NOT NULL,
`uname` VARCHAR(50),
`zone` INT NOT NULL,
`age` INT,
`create_time` datetime NOT NULL,
PRIMARY KEY (`user_id`,`email`),
FOREIGN KEY(zone) REFERENCES zones(z_id)
)ENGINE=INNODB;
-- DROP TABLE IF EXISTS `user_info`;
-- CREATE TABLE `user_info` (
-- `user_id` int(11) NOT NULL,
-- `email` varchar(50) NOT NULL,
-- `pwd` varchar(50) NOT NULL,
-- `uname` varchar(50) DEFAULT NULL,
-- `zone` int(11) NOT NULL,
-- `age` int(11) DEFAULT NULL,
-- `create_time` datetime NOT NULL,
-- PRIMARY KEY (`user_id`,`email`)
-- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;