Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 这是一个多对多关系模型_Mysql - Fatal编程技术网

Mysql 这是一个多对多关系模型

Mysql 这是一个多对多关系模型,mysql,Mysql,这个代码有什么问题。第三个表显示了一条错误消息。第一个和第二个表中没有错误。下面是错误消息。请帮我找出错误的原因 错误消息: mysql> create table Registation( -> cid int, -> sid int, -> reg Date date, -> reg_fee int not null default 2000, -> constraint primary key (sid,cid), -> constraint fo

这个代码有什么问题。第三个表显示了一条错误消息。第一个和第二个表中没有错误。下面是错误消息。请帮我找出错误的原因

错误消息:

mysql> create table Registation(
-> cid int,
-> sid int,
-> reg Date date,
-> reg_fee int not null default 2000,
-> constraint primary key (sid,cid),
-> constraint foreign key(sid) references student(sid)
-> on delete cascade on update cascade,
-> constraint foreign key(cid) references course(cid)
-> on delete cascade on update cascade );
错误1064(42000):您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,了解在“日期”附近使用的正确语法, 注册费整数不为空默认值2000, 约束主键(sid、cid), 四号线的常数

我的SQL表代码:


您的登记表不正确

create table Registation(
cid int,
sid int,
reg Date date,/* line 1
reg_fee int not null default 2000,
constraint primary key (sid,cid),
constraint foreign key(sid) references student(sid)
on delete cascade on update cascade,
constraint foreign key(cid) references course(cid)
on delete cascade on update cascade ); 
第1行修改为reg date

正确的代码是

create table Registation(
cid int,
sid int,
Date date,/* line 1
reg_fee int not null default 2000,
constraint primary key (sid,cid),
constraint foreign key(sid) references student(sid)
on delete cascade on update cascade,
constraint foreign key(cid) references course(cid)
on delete cascade on update cascade ); 


感谢您Shashini Probodha“非引号标识符中允许的字符:ASCII:[0-9,a-z,a-z$U](基本拉丁字母,数字0-9,美元,下划线)扩展:U+0080。。U+FFFF'你应该检查并修复注册日期哦,谢谢你Anirban166
create table Registation(
cid int,
sid int,
Date date,/* line 1
reg_fee int not null default 2000,
constraint primary key (sid,cid),
constraint foreign key(sid) references student(sid)
on delete cascade on update cascade,
constraint foreign key(cid) references course(cid)
on delete cascade on update cascade ); 
create table Registation(
cid int,
sid int,
reg_Date date,/* line 1
reg_fee int not null default 2000,
constraint primary key (sid,cid),
constraint foreign key(sid) references student(sid)
on delete cascade on update cascade,
constraint foreign key(cid) references course(cid)
on delete cascade on update cascade );