Which two statements are true about the primary key constraint in a table? ()A、It is not possible to disable the primary key constraint.B、It is possible to have more than one primary key constraint in a single table.C、The primary key constraint can be ref

题目

Which two statements are true about the primary key constraint in a table? ()

  • A、It is not possible to disable the primary key constraint.
  • B、It is possible to have more than one primary key constraint in a single table.
  • C、The primary key constraint can be referred by only one foreign key constraint.
  • D、The primary key constraint can be imposed by combining more than one column.
  • E、The non-deferrable primary key constraint creates an unique index on the primary key column if it is not already indexed.
参考答案和解析
正确答案:D,E
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Examine the following commands for redefining a table with Virtual Private Database (VPD) policies:Which two statements are true about redefining the table?()

A. All the triggers for the table are disabled without changing any of the column names or column types in the table.

B. The primary key constraint on the EMPLOYEES table is disabled during redefinition.

C. VPD policies are copied from the original table to the new table during online redefinition.

D. You must copy the VPD policies manually from the original table to the new table during online redefinition.


参考答案:B, C

第2题:

Given the following requirements:Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values ‘C‘, ‘H‘ and ‘N‘, and permits inserts only when a corresponding value for the employee‘s department exists in the DEPARTMENT table.Which of the following CREATE statements will successfully create this table?()

A.CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN (‘C‘,‘H‘,‘N‘)), );

B.CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES (‘C‘,‘H‘,‘N‘) );

C.CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN (‘C‘,‘H‘,‘N‘)), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );

D.CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN (‘C‘,‘H‘,‘N‘)) );


参考答案:D

第3题:

Which constraint can be defined only at the column level? ()

A. UNIQUE

B. NOT NULL

C. CHECK

D. PRIMARY KEY

E. FOREIGN KEY


参考答案:B

第4题:

Given the following requirements: Create a table to contain employee data, with a unique numeric identifier automatically assigned when a row is added, has an EDLEVEL column that permits only the values 'C', 'H' and 'N', and permits inserts only when a corresponding value for the employee's department exists in the DEPARTMENT table. Which of the following CREATE statements will successfully create this table?()

  • A、CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED ALWAYS AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1), PRIMARY KEY emp_pk (empno), FOREIGN KEY emp_workdept_fk ON (workdept) REFERENCES department (deptno), CHECK edlevel_ck VALUES (edlevel IN ('C','H','N')), );
  • B、CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK edlevel VALUES ('C','H','N') );
  • C、CREATE TABLE emp ( empno SMALLINT NEXTVAL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3) NOT NULL, edlevel CHAR(1) CHECK IN ('C','H','N')), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY department (deptno) REFERENCES (workdept) );
  • D、CREATE TABLE emp ( empno SMALLINT NOT NULL GENERATED BY DEFAULT AS IDENTITY, firstname VARCHAR(30) NOT NULL, lastname VARCHAR(30) NOT NULL, workdept CHAR(3), edlevel CHAR(1), CONSTRAINT emp_pk PRIMARY KEY (empno), CONSTRAINT emp_workdept_fk FOREIGN KEY (workdept) REFERENCES department (deptno), CONSTRAINT edlevel_ck CHECK (edlevel IN ('C','H','N')) );

正确答案:D

第5题:

Which of the following scenarios will ensure that the value of the NEXT_STEPNO column in a given row of table TABLEX exists as a value of column STEPNO (usually in another row) in the same table?()

  • A、Define a UNIQUE constraint on the columns NEXT_STEPNO and STEPNO.
  • B、Define a CHECK constraint on the NEXT_STEPNO column (NEXT_STEPNO = STEPNO).
  • C、Define column STEPNO as the primary key of TABLEX and column NEXT_STEPNO as a foreign key referencing column STEPNO of the same table.
  • D、Define column NEXT_STEPNO as the primary key of TABLEX and column STEPNO as a foreign key referencing column NEXT_STEPNO in the same table.

正确答案:C

第6题:

Which of the following scenarios will ensure that the value of the NEXT_STEPNO column in a given row of table TABLEX exists as a value of column STEPNO (usually in another row) in the same table?()

A.Define a UNIQUE constraint on the columns NEXT_STEPNO and STEPNO.

B.Define a CHECK constraint on the NEXT_STEPNO column (NEXT_STEPNO = STEPNO).

C.Define column STEPNO as the primary key of TABLEX and column NEXT_STEPNO as a foreign key referencing column STEPNO of the same table.

D.Define column NEXT_STEPNO as the primary key of TABLEX and column STEPNO as a foreign key referencing column NEXT_STEPNO in the same table.


参考答案:C

第7题:

为表TEST中ID列添加主键约束的语法是()

  • A、ALTER  TABLE  TEST  CHANGE( ID  INT  PRIMARY  KEY)
  • B、ALTER  TABLE  TEST  ADD( ID  INT  PRIMARY  KEY)
  • C、ALTER  TABLE  TEST  MODIFY( ID  INT  PRIMARY  KEY)
  • D、ALTER  TABLE  TEST  ADD  CONSTRAINT PK  PRIMARY KEY (ID)

正确答案:D

第8题:

You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty. Which statement accomplishes this task?()

A. ALTER TABLE students ADD PRIMARY KEY _ id;

B. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);

C. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;

D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);

E. ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);


参考答案:D

第9题:

数据库中的中的PROFITS表中PRODUCT_NAME与SALE_PERIOD列建立主键。下列哪个语句无法定义这个主键?()

  • A、create table profits(product_name varchar2(10),sale_perion varchar2(10),profit number, constraint pk_profits_01 primary key(product_name,sale_period))
  • B、alter table profits add constraint pk_profits_01 primary key(product_name,sale_period)deferrabl
  • C、以上两者都是

正确答案:B

第10题:

When defining a referential constraint between the parent table T2 and the dependent table T1, which of the following is true?()

  • A、The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.
  • B、The list of column names in the FOREIGN KEY clause can be a subset of the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.
  • C、The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T2 or a UNIQUE constraint that exists on T2.
  • D、The list of column names in the FOREIGN KEY clause must be identical to the list of column names in the primary key of T1 or a UNIQUE constraint that exists on T1.

正确答案:C

更多相关问题