表student信息:
student  CREATE TABLE `student` (                                                                                                                                                                                                                                                                                                                              
           `sid` varchar(30) NOT NULL,                                                                                                                                                                                                                                                                                                                         
           `sname` varchar(50) NOT NULL,                                                                                                                                                                                                                                                                                                                       
           `sbirthday` date NOT NULL,                                                                                                                                                                                                                                                                                                                          
           `ssex` int(11) DEFAULT NULL,                                                                                                                                                                                                                                                                                                                        
           `cid` varchar(20) NOT NULL,                                                                                                                                                                                                                                                                                                                         
           PRIMARY KEY (`sid`),                                                                                                                                                                                                                                                                                                                                
           KEY `cid` (`cid`),                                                                                                                                                                                                                                                                                                                                  
           CONSTRAINT `student_ibfk_1` FOREIGN KEY (`cid`) REFERENCES `classinfo` (`cid`)                                                                                                                                                                                                                                                                      
         ) ENGINE=InnoDB DEFAULT CHARSET=latin1 新建studentcard遇到问题
CREATE TABLE studentcard(
sid VARCHAR(30) PRIMARY KEY,
carddate DATE NOT NULL,
cardbg INT DEFAULT 1 CHECK(cardbg>=1)

);错误代码: 1050
Table 'studentcard' already exists

解决方案 »

  1.   

    问题少打了一行代码:
    CREATE TABLE studentcard(
    sid VARCHAR(30) PRIMARY KEY,
    carddate DATE NOT NULL,
    cardbg INT DEFAULT 1 CHECK(cardbg>=1),
    FOREIGN KEY(sid) REFERENCES student(sid)
    );
      

  2.   

    提示studentcard表已经存在,检查一下数据库中是否已经有这个表了
      

  3.   

    错误代码: 1050
    Table 'studentcard' already exists
    提示你,表已经存在了,可以删除他drop table studentcard;
      

  4.   

    Table 'studentcard' already exists以后碰到类似问题,可以把整句英语放在翻译网站上翻译阅读后处理。