SQL Ch 4

¡Supera tus tareas y exámenes ahora con Quizwiz!

Which of the following types of constraints will not allow NULL values?

PRIMARY KEY

What is the syntax for the default constraint name provided by the Oracle 12c server?

SYS_Cn

Which of the following statements about creating constraints is incorrect?

The NOT NULL constraint can be created at either the column level or the table level.

Which of the following statements about the FOREIGN KEY constraint is incorrect?

The constraint can reference any column in another table, even a column that has not been designated as the primary key for the referenced table.

A constraint is always enforced at the table level.

True

A(n) FOREIGN KEY constraint can only reference a column in the parent table that has been designated as the primary key for that table.

True

A(n) FOREIGN KEY constraint is used to ensure that referential integrity exists between tables. _________________________

True

A(n) NOT NULL constraint is a special CHECK constraint with the condition of IS NOT NULL. _________________________

True

A(n) UNIQUE constraint will allow NULL values to be stored in the designated column. _________________________

True

A(n) constraint can be created during the creation of a database table or added to a table afterwards. _________________________

True

Any type of constraint for a single column can be created at the column level. _________________________

True

Constraints are rules used to enforce business rules, practices, and policies.

True

Constraints are used to ensure the accuracy and integrity of the data contained in the database.

True

Only one PRIMARY KEY constraint can exist for each table.

True

The ADD clause of the ALTER TABLE command is used to add a PRIMARY KEY constraint to an existing table. ______________

True

The ALTER TABLE command with the ENABLE clause can be used to enable a constraint.

True

When a constraint is created at the ____ level with the CREATE TABLE command, the constraint definition is simply included as part of the column definition.

column

A PRIMARY KEY that consists of more than one column is called a(n) ____ key.

composite

Which of the following are used to enforce business rules?

constraints

Which of the following is the standard abbreviation for the constraint NOT NULL?

nn

When used with a FOREIGN KEY, the keyword REFERENCES refers to what?

referential integrity

Constraints are always enforced at the ____ level.

row

If a constraint applies to more than one column, the constraint must be created at the ____ level.

table

Structure of the ORDERITEMS table.vBased on the structure of the ORDERITEMS table, which of the following commands will make certain that the ISBN entered actually exists in the ISBN column of the BOOKS table?

ALTER TABLE orderitems ADD FOREIGN KEY (isbn) REFERENCES books(isbn);

Structure of the ORDERITEMS table. If a PRIMARY KEY constraint, named ORDERITEMS_PK, exists for the ORDER# and ITEM# columns of the ORDERITEMS table, which of the following commands will drop the constraint?

ALTER TABLE orderitems DROP PRIMARY KEY;

Structure of the ORDERITEMS table. If the constraints on the ORDER# and ITEM# columns of the ORDERITEMS table were created as a PRIMARY constraint, and the actual constraint name is not known, which of the following commands can be used to delete the constraint?

ALTER TABLE orderitems DROP PRIMARY KEY;

Structure of the ORDERITEMS table. If a PRIMARY KEY constraint, named ORDERITEMS_PK, for the ORDER# and ITEM# columns of the ORDERITEMS table have been disabled, which of the following commands will enable the constraint?

ALTER TABLE orderitems ENABLE CONSTRAINT orderitems_pk;

In the USER_CONSTRAINTS view, the value displayed in the CONSTRAINT_TYPE column will be a(n) ____ for a CHECK constraint.

C

Structure of the ORDERITEMS table. Based on the structure of the ORDERITEMS table, which of the following commands was most likely used to create the table?

CREATE TABLE orderitems (order# NUMBER (4), item# NUMBER(2), isbn VARCHAR2(10), qty NUMBER(3), PRIMARY KEY(order#, item#));

Structure of the PROMOTION table. Based on the structure of the PROMOTION table, which of the following commands will add a PRIMARY KEY constraint to the GIFT column?

CREATE TABLE promotion (gift VARCHAR2(15) PRIMARY KEY, minretail NUMBER(5, 2), maxretail NUMBER(5, 2)); ALTER TABLE promotion ADD PRIMARY KEY(gift);

A FOREIGN KEY constraint will not allow a row containing a NULL value in the foreign key column to be added to the table.

False

A NOT NULL constraint can only be added to an existing table by using the ADD clause with the ALTER TABLE command. _________________________

False

A NOT NULL constraint can only be created at the table level. _________________________

False

A constraint can only be created as part of the CREATE TABLE command.

False

A foreign key constraint can only be created at the column level.

False

Each column can only be included in one constraint.

False

The ALTER TABLE command with the MODIFY clause can be used to disable a constraint. _________________________

False

The MODIFY clause is used with the ALTER TABLE command to add a PRIMARY KEY constraint to an existing table.

False

The SYSDATE can be used as a condition in a CHECK constraint.

False

The data warehouse contains information about objects included in the database. _________________________

False

The table level approach can be used to create any constraint, except a CHECK constraint.

False

When a FOREIGN KEY constraint is being created, the REFERENTIAL keyword is used to indicate the table being referenced.

False

When dropping a constraint, the user is always required to specify the name of the constraint being dropped.

False

Which of the following statements about creating constraints is incorrect?

If you do not provide a name for a constraint, the Oracle 12c server will issue an error message.

Which of the following statements about a PRIMARY KEY is incorrect?

It can be NULL, as long as the FOREIGN KEY contains a value.

The ____ constraint prevents the user from adding a NULL value in the specified column.

NOT NULL

Which of the following keywords must have been included during the creation of a FOREIGN KEY constraint to allow a row from the parent table to be deleted, even if it is referenced by a row in the child table?

ON DELETE CASCADE

When a constraint is created at the table level, the constraint definition is provided ____ the column definition list.

after

Which of the following is a valid statement?

all of the above

The NOT NULL constraint can only be created at the ____ level.

column


Conjuntos de estudio relacionados

Chapter 12: Substance Use and Addictive Disorders

View Set

Practice Quiz - Chapter 13 Contracts in writing and third party contracts

View Set

Chapter 7: Software Testing (Part 2)

View Set

Lesson 2 - The Founding of the United Nations (95.83%)

View Set