When I use alter and add statement I get an error
The SQL code is:
create table lecturer (
lecturer_id int primary key,
lecturer_name varchar(20)
)
create table course_lecturer(
date varchar(20)
)
alter table course_lecturer
add foreign key(lecturer_id) references lecturer(lecturer_id)
The error boils down to:
Near "foreign key": syntax error
I want to link between lecturer table and course_lecturer
create table lecturer (
lecturer_id int primary key,
lecturer_name varchar(20)
)
create table course_lecturer(
//U need here a lecturer_id for bind the fk
date varchar(20)
)
alter table course_lecturer
add foreign key(lecturer_id) references lecturer(lecturer_id)
Hope this help!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.