create table leaveapp(
id int auto_increment,
vipid int not null ,
leavetime date not null,
leavelength int(4) not null,
leavesubname varchar(50) not null,
leavestate char not null dafault '1',
primary key(id),
foreign key(vipid) references vipstudent(vipid)
);
错在哪里

解决方案 »

  1.   

    错在哪里, MYSQL会告诉你的。mysql> create table leaveapp(
        ->  id int auto_increment,
        ->  vipid int not null ,
        ->  leavetime date not null,
        ->  leavelength int(4) not null,
        ->  leavesubname varchar(50) not null,
        ->  leavestate char not null dafault '1',
        ->  primary key(id),
        ->  foreign key(vipid) references vipstudent(vipid)
        -> );
    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use near 'dafau
    lt '1',
            primary key(id),
            foreign key(vipid) references vipstudent(vipid)
    ' at line 7
    mysql>
    leavestate char not null dafault '1',leavestate char not null default '1',拼写错误。