user表
user用户信息(#用户名,密码,用户类型)
Username varchar(20) 主键
Password varchar(20)
Usertype enum(‘1’,’2’,’3’)
创建Text表,多列成为主键,并引入外键
CREATE TABLE IF NOT EXISTS `text`(
`username` varchar(20),
`text_id` int,
`text_title` VARCHAR(20) NOT NULL,
`t_create_time` datetime NOT NULL,
`t_final_update_time` timestamp NOT NULL,
`t_content` mediumblob NOT NULL,
PRIMARY KEY (`username`, `text_id` ),
foreign key(`username`) references user(username)
)ENGINE=InnoDB DEFAULT CHARSET=utf8
遇见的问题:
多列形成主键的时候,其中一列设置为自增长之后,出现:
[Err] 1075 - Incorrect table definition; there can be only one auto column and it must be defined as
目前尚未解决。。。。。