create table student
(
Student_id number(30),
student_name varchar(30),
city varchar(30),
constraint pk primary key(student_id),
constraint department_id
foreign key(department_id) references department(department_id)
);
答案 0 :(得分:2)
由于department_id
表中没有student
,因此无法将其称为键。
在department_id
表中添加一个student
列,其数据类型与department
表中的数据类型相同。
答案 1 :(得分:0)
尝试一下
create table student
(
Student_id number (30),
student_name varchar(30),
department_id int,
city varchar (30),
Constraint pk primary key(student_id),
constraint department_id foreign key(department_id) references department (department_id)
) ;