CIS 219 (Oracle PL/SQL) Chapter 4
Which of the following commands will add a UNIQUE constraint to the MINRETAIL column of the PROMOTION table?
ADD CONSTRAINT orderitems_minretail_uk UNIQUE (minretail);
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;
Based 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);
Based on the structure of the PROMOTION table, which of the following commands will add a PRIMARY KEY constraint to the GIFT column?
ALTER TABLE promotion ADD PRIMARY KEY(gift);
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#)):
If the ON DELETE CASCADE keywords are included when a(n) PRIMARY KEY constraint is created, then if a row is deleted from the parent table, any corresponding records in the child table are also deleted.
False
The data warehouse contains information about objects included in the database.
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
A primary key is usually given the abbreviation pk in the constraint name if the name is assigned by the user.
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
Any type of constraint for a single column can be created at the çolumn level.
True
Both the fable-level and column-level approaches to creating a constraint can be included in the same command.
True
Constraints are used to ensure the accuracy and integrity of the data contained in the database.
True
If a FOREIGN KEY constraint exists, then a record cannot be deleted from the parent table if that row is referenced by an entry in the child table.
True
The ALTER TABLE command can be used to delete an existing constraint.
True
With the exception of the NOT NULL constraint, constraints can be added to a table using the ADD clause of the ALTER TABLE command.
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 FOREIGN KEY constraint can only reference a column in another table that has been assigned a(n) _________ constraint.
none of the above
When used with a FOREIGN KEY, the keyword REFERENCES refers to what?
referential integrity
The _________ constraint requires that a specific condition be met before a record can be added to a table.
CНЕCK
Which command can be used to determine whether or not a column is allowed to contain a NULL value?
DESCRIBE
Which of the following types of constraints is used to enforce referential integrity?
FOREIGN KEY
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
In the USER CONSTRAINTS view, the constraint type for a PRIMARY KEY constraint will be listed as PK.
False
The ALTER TABLE command with the MODIFY clause can be used to disable a constraint.
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.
Which view will display the names of all the constraints that you own?
USER CONSTRAINTS
Which of the following is the standard abbreviation for the constraint FOREIGN KEY?
fk
Where does the Oracle 12c server store information about objects in the database, including information about constraints?
in the data dictionary
Which of the following is the standard abbreviation for the constraint NOT NULL?
nn
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
In the USER CONSTRAINTS view, the value displayed in the CONSTRAINT_TYPE column will be a(n) ________ for a CHECK constraint.
C
Which of the following constraints cannot be added to an existing table with the ADD clause of the ALTER TABLE command?
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
Which of the following is not a constraint type in Oracle 12c?
REFERENCE
The purpose of the ________ constraint is to ensure that two records do not have the same value stored in the same column. However, it can contain NULL values.
UNIQUE
A FOREIGN KEY constraint can be added to the column of a table to ensure that the referenced data value actually exists in the other table.
True
A PRIMARY KEY constraint will make certain the column designated as the primary key does not contain a NULL value.
True
A UNIQUE constraint is the same as a PRIMARY KEY constraint, except that it will accept NULL values.
True
A constraint for a composite primary key must be created at the table level.
True
A constraint is always enforced at the table level.
True
The ALTER TABLE command can be used to disable a constraint.
True
The ALTER TABLE command with the ENABLE clause can be used to enable a constraint.
True
The CONSTRAINT keyword is required if the user is going to assign a name to a constraint.
True
A PRIMARY KEY that consists of more than one column is called a(n) _______ key.
composite