为啥老要报错啊,。?


mysql> create table `student` (
    -> `sno` char(9) not null comment '学号',
    -> `sname` varchar(10) not null comment '姓名',
    -> `ssex` char(2) default null comment '性别',
    -> `sbirthday` data default null comment '年龄',
    -> `sdept` varchar(8) not null comment '系别',
    -> primary key (`sno`)
    -> );
1064 - 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 '-> `sno` char(9) not null comment '学号',
    -> `sname` varchar(10) not null' at line 2

按照这个执行 -> sbirthday data default null comment '年龄', date而不是data吧

create table student (
     `sno` char(9) not null comment '学号',
     `sname` varchar(10) not null comment '姓名',
     `ssex` char(2) default null comment '性别',
     `sbirthday` date default null comment '年龄',
     `sdept` varchar(8) not null comment '系别',
     primary key (`sno`)
     );

你是否把“->"也贴到命令行窗口了?

把每行的->去掉,直接复制这个:

create table `student` (
   `sno` char(9) not null comment '学号',
   `sname` varchar(10) not null comment '姓名',
   `ssex` char(2) default null comment '性别',
   `sbirthday` data default null comment '年龄',
   `sdept` varchar(8) not null comment '系别',
   primary key (`sno`)
);