一、原题
二、题目翻译
三、题目解析
You need to design a student registration database that contains several tables storing academic
information.
The STUDENTS table stores information about a student. The STUDENT_GRADES table stores
information about the student's grades. Both of the tables have a column named STUDENT_ID.
The STUDENT_ID column in the STUDENTS table is a primary key.
You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table
that points to the STUDENT_ID column of the STUDENTS table. Which statement creates the
foreign key?
A.
CREATE TABLE student_grades (student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT student_id_fk REFERENCES (student_id) FOREIGN KEY students(student_id));
B.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));
C.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT FOREIGN KEY (student_id) REFERENCES students(student_id));
D.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));
答案: D
information.
The STUDENTS table stores information about a student. The STUDENT_GRADES table stores
information about the student's grades. Both of the tables have a column named STUDENT_ID.
The STUDENT_ID column in the STUDENTS table is a primary key.
You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table
that points to the STUDENT_ID column of the STUDENTS table. Which statement creates the
foreign key?
A.
CREATE TABLE student_grades (student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT student_id_fk REFERENCES (student_id) FOREIGN KEY students(student_id));
B.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));
C.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT FOREIGN KEY (student_id) REFERENCES students(student_id));
D.
CREATE TABLE student_grades(student_id NUMBER(12),
semester_end DATE,
gpa NUMBER(4,3),
CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students(student_id));
答案: D
二、题目翻译
要设计一个包含几个表的存储大学生注册信息的数据库。
STUDENTS表保存学生信息,STUDENT_GRADES表保存学生的成绩信息,这两张表都有一列STUDENT_ID,STUDENTS表中的STUDENT_ID列是主键。
现在要在STUDENT_GRADES表上建一个STUDENT_ID列的外键,下面哪个是建外键的语句?
STUDENTS表保存学生信息,STUDENT_GRADES表保存学生的成绩信息,这两张表都有一列STUDENT_ID,STUDENTS表中的STUDENT_ID列是主键。
现在要在STUDENT_GRADES表上建一个STUDENT_ID列的外键,下面哪个是建外键的语句?
三、题目解析
这个就是语法问题,查一下语法图,就可以了。