單項選擇題

以下SQL命令執(zhí)行什么操作()
ALTER TABLE employees
ADD CONSTRAINT emp_manager_fk FOREIGN KEY(manager_id) REFERENCES employees(employee_id).

A.更改employees表并禁用emp_manager_fk約束條件
B.向EMPLOYEES表添加FOREIGN KEY約束條件,要求經(jīng)理必須已是雇員
C.向EMPLOYEES表添加FOREIGN KEY約束條件,要求經(jīng)理標(biāo)識應(yīng)匹配每個雇員標(biāo)識
D.更改employees表并添加FOREIGN KEY約束,要求每個雇員標(biāo)識必須唯一


您可能感興趣的試卷

你可能感興趣的試題

1.單項選擇題您在公司的數(shù)據(jù)庫中成功創(chuàng)建了名為SALARY的表。您現(xiàn)在要通過向引用EMPLOYEES表的匹配列的SALARY表添加FOREIGNKEY約束條件來建立EMPLOYEES表與SALARY表之間的父/子關(guān)系。尚未向SALARY表添加任何數(shù)據(jù)。應(yīng)執(zhí)行以下哪條語句()

A.ALTER TABLE salary ADD CONSTRAINT fk_employee_id_01 FOREIGN KEY(employee_id)REFERENCES employees(employee_id)
B.ALTER TABLE salary ADD CONSTRAINT fk_employee_id_ FOREIGN KEY BETWEEN salary(employee_id)AND employees(employee_id)
C.ALTER TABLE salary FOREIGN KEY CONSTRAINT fk_employee_id_REFERENCES employees(employee_id)
D.ALTER TABLE salary ADD CONSTRAINT fk_employee_id_FOREIGN KEY salary(employee_id)=employees(employee_id)

2.單項選擇題刪除PRIMARYKEY約束條件及其所有依賴約束條件的語法是什么()

A.ALTER TABLE table_name DROP CONSTRAINT constraint_name CASCADE
B.ALTER TABLE table_name DROP CONSTRAINT FOREIGN KEY CASCADE
C.DROP CONSTRAINT table_name(constraint_name)
D.ALTER TABLE table_name DROP CONSTRAINT constraint_name

3.單項選擇題要向雇員表中的部門標(biāo)識列添加FOREIGNKEY約束條件以引用部門表中的標(biāo)識列,應(yīng)該使用哪個語句()

A.ALTER TABLE雇員MODIFY COLUMN dept_id_fk FOREIGN KEY(部門標(biāo)識)REFERENCES部門(部門標(biāo)識)
B.ALTER TABLE雇員ADD CONSTRAINT dept_id_fk FOREIGNKEY(部門標(biāo)識)REFERENCES部門(部門標(biāo)識)
C.ALTER TABLE雇員ADD FOREIGN KEY CONSTRAINT dept_id_fk ON(部門標(biāo)識)REFERENCES部門(部門標(biāo)識)
D.ALTER TABLE雇員ADD FOREIGN KEY 部門(部門標(biāo)識)REFERENCES(部門標(biāo)識)

4.單項選擇題可以通過查找哪個數(shù)據(jù)字典表來查看為特定表定義的約束條件()

A.USER_CONSTRAINTS
B.CONSTRAINTS_ALL
C.SYS_DATA_DICT
D.US_CON_SYS

5.單項選擇題

DEPARTMENT 表包含以下列:
DEPT_ID NUMBER, Primary Key
DEPT_ABBR VARCHAR2(4)
DEPT_NAME VARCHAR2(30)
MGR_ID NUMBER
EMPLOYEE 表包含以下列:
EMPLOYEE_ID NUMBER
EMP_LNAME VARCHAR2(25)
EMP_FNAME VARCHAR2(25)
DEPT_ID NUMBER
JOB_ID NUMBER
MGR_ID NUMBER
SALARY NUMBER(9,2)
HIRE_DATE DATE
請評估以下語句:
ALTER TABLE employee
ADD CONSTRAINT REFERENTIAL (mgr_id) TO department(mgr_id);
是以下哪個說法()

A.ALTER TABLE語句創(chuàng)建從EMPLOYEE表到DEPARTMENT表的引用約束條件
B.ALTER TABLE語句創(chuàng)建從DEPARTMENT表到EMPLOYEE表的引用約束條件
C.ADD CONSTRAINT子句存在語法錯誤,因此ALTER TABLE語句將會失敗
D.ALTER TABLE語句執(zhí)行成功,但不重新創(chuàng)建引用約束條件