Which two statements are true about constraints? ()A、The UNIQUE constraint does not permit a null value for the column.B、A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.C、The PRIMARY KEY and FOREIGN KEY constraints create a

题目

Which two statements are true about constraints? ()

  • A、The UNIQUE constraint does not permit a null value for the column.
  • B、A UNIQUE index gets created for columns with PRIMARY KEY and UNIQUE constraints.
  • C、The PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index.
  • D、The NOT NULL constraint ensures that null values are not permitted for the column.
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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

第2题:

在设计数据库时,要充分考虑数据的完整性或准确性。下面关于primary key和unique的描述错误的是()

  • A、设为unique的列的值是不能重复的,用来唯一区别unique列的值
  • B、primary key列不可以有null值,而unique列是可以有null的
  • C、primary key列和unique列都不可以有null值
  • D、primary key用来在表中设置主键,主键列的值是可以重复的,用来唯一标识表中的每一条记录

正确答案:C,D

第3题:

The InnoDB engine has a feature known as clustered indexes.Which three statements are true about clustered indexes as used in InnoDB?()

A.A primary key must exist for creation of a clustered index

B.A clustered index allows fulltext searching within InnoDB

C.The first unique index is always used as a clustered index and not a primary key

D.A clustered index provides direct access to a page containing row data

E.If no indexes exist, a hidden clustered index is generated based on row IDs

F.A primary key is used as a clustered index

G.A clustered index is a grouping of indexes from different tables into a global index for faster searching


参考答案:D, E, F

第4题:

For which two constraints does the Oracle Server implicitly create a unique index?()

  • A、NOT NULL
  • B、PRIMARY KEY
  • C、FOREIGN KEY
  • D、CHECK
  • E、UNIQUE

正确答案:B,E

第5题:

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

第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题:

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

第8题:

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

第9题:

Evaluate the CREATE TABLE statement:   CREATE TABLE products   (product_id NUMBER (6)  CONSTRAINT prod_id_pk PRIMARY KEY,  product_name VARCHAR2 (15));   Which statement is true regarding the PROD_ID_PK constraint?()

  • A、 It would be created only if a unique index is manually created first.
  • B、 It would be created and would use an automatically created unique index.
  • C、 It would be created and would use an automatically created nonunique index.
  • D、 It would be created and remains in a disabled state because no index is specified in the command.

正确答案:B

第10题:

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

更多相关问题