2016-11-01
展开全部
ALTER TABLE student
ADD
系号 INT
constraint xh_fk foreign key (系号) references dept (系号)
ALTER TABLE course
ADD
选修课 char(4),
任课老师 char
--按照id插入教师的话
update course
set course.任课老师=teacher.任课老师
from course join (select *, row_number() over(order by id) rn from teacher) t2
on course.id=teacher.rn
ADD
系号 INT
constraint xh_fk foreign key (系号) references dept (系号)
ALTER TABLE course
ADD
选修课 char(4),
任课老师 char
--按照id插入教师的话
update course
set course.任课老师=teacher.任课老师
from course join (select *, row_number() over(order by id) rn from teacher) t2
on course.id=teacher.rn
更多追问追答
追问
您好我问一下contraint xh_fk,这个xh_fk是什么意思
你好,第二个问题的引用teacher表具体要怎么写
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询