Constraints
A maximum of ____________________ PRIMARY KEY constraints can exist for each database table.
1 or one
A PRIMARY KEY constraint can be added to an existing table by using the ____ clause of the ALTER TABLE command.
ADD
The ____________________ clause of the ALTER TABLE command is used to add a PRIMARY KEY constraint to an existing table.
ADD
The ____________________ TABLE command is used to add a PRIMARY KEY constraint to an existing table.
ALTER
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;
The ____ constraint requires that a specific condition be met before a record can be added to a table.
CHECK
If a user is going to assign a name to a constraint, the ____________________ keyword must be included in the command.
CONSTRAINT
If the ____ keyword is included when a constraint is created, a constraint name must be provided by the user.
CONSTRAINT
The ALTER TABLE command with the MODIFY clause can be used to disable a constraint. _________________________
FALSE
A NOT NULL constraint will display the search condition of ____________________ in the USER_CONSTRAINTS view.
IS NOT NULL
A NOT NULL constraint can be added to an existing table using the ALTER TABLE command with the ____________________ clause.
MODIFY
A(n) ____________________ constraint is a special CHECK constraint with the condition of IS NOT NULL.
NOT NULL
The ____ constraint prevents the user from adding a NULL value in the specified column.
NOT NULL
Which of the following constraints cannot be added to an existing table with the ADD clause of the ALTER TABLE command?
NOT NULL
Only one ____ constraint can exist for each table.
PRIMARY KEY
If a FOREIGN KEY constraint is displayed in the USER_CONSTRAINTS view, the constraint type will have the letter ____________________ displayed.
R
In the USER_CONSTRAINTS view, the value displayed in the CONSTRAINT_TYPE column will be a(n) ____ for a FOREIGN KEY constraint.
R
If the Oracle 12c server assigns a name to a constraint, it will use the format ____________________ for the constraint name.
SYS_Cn
What is the syntax for the default constraint name provided by the Oracle 12c server?
SYS_Cn
Any type of constraint for a single column can be created at the column level. _________________________
TRUE
The default name for a constraint is SYS Cn where n consists of a number that will make the name unique within the database. _________________________
TRUE
A(n) ____________________ constraint requires that, if an entry is made into the column, the data value must be unique.
UNIQUE
If a(n) ____________________ constraint is being dropped, then only the type of constraint and the column name need to be included in the DROP clause of the ALTER TABLE command.
UNIQUE
When a constraint is created at the table level, the constraint definition is provided ____ the column definition list.
after
The ____________________ command can be used to enable or disable a constraint.
alter table
Any type of constraint can be created at the ____________________ level, unless the constraint is being defined for more than one column.
column
The NOT NULL constraint can only be created at the ____ level.
column
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
A(n) ____________________ is a rule imposed on data stored in a database in order to ensure its integrity of the data.
constraint
Which of the following are used to enforce business rules?
constraints
A Datatype is a rule used to ensure the accuracy of data stored in a database. _________________________
false
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 created at the table level. _________________________
false
A NOT NULL constraint is a special FOREIGN KEY constraint.
false
Each column can only be included in one constraint.
false
Where does the Oracle 12c server store information about objects in the database, including information about constraints?
in the data dictionary
Referential ____________________ means that the user is referring to something that actually exists in the referenced table.
integrity
A referential integrity constraint is usually placed on the ____________________ side of a one-to-many relationship.
many
Which of the following is the standard abbreviation for the constraint NOT NULL?
nn
A FOREIGN KEY constraint can only reference a column in another table that has been assigned a(n) ____ constraint.
none of the above
If a constraint applies to more than one column, the constraint must be created at the ____ level.
table
The CONSTRAINT keyword is required if the user is going to assign a name to a constraint.
true
The UNIQUE constraint differs from the PRIMARY KEY constraint in what way?
The UNIQUE constraint allows NULL values.
Which view will display the names of all the constraints that you own?
USER_CONSTRAINTS
Which of the following types of constraints will not allow NULL values?
PRIMARY KEY
A constraint can be renamed using the ALTER TABLE command.
false
Structure of the ORDERITEMS table Based on the structure of the ORDERITEMS table, which of the following commands will add a NOT NULL constraint to the ISBN column?
none of the above
Structure of the ORDERITEMS table Based on the structure of the ORDERITEMS table, which of the following commands will add a NOT NULL constraint to the ISBN column?
none of the above
If a(n) ____________________ constraint is being dropped, then only the type of constraint needs to be identified in the ALTER TABLE because there can only be one such constraint for each table.
primary key
A NOT NULL constraint can only be created at the column level.
true
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#));
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 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.
Structure of the ORDERITEMS table 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);
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 disable the constraint?
ALTER TABLE orderitems DISABLE CONSTRAINT orderitems_pk;
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 disable the constraint?
ALTER TABLE orderitems DISABLE CONSTRAINT orderitems_pk;
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;
Structure of the PROMOTION table Which of the following commands will add a UNIQUE constraint to the MINRETAIL column of the PROMOTION table?
ALTER TABLE promotion ADD CONSTRAINT orderitems_minretail_uk UNIQUE (minretail);
Structure of the PROMOTION table Which of the following commands will add a UNIQUE constraint to the MINRETAIL column of the PROMOTION table?
ALTER TABLE promotion ADD CONSTRAINT orderitems_minretail_uk UNIQUE (minretail);
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?
ALTER TABLE promotion ADD PRIMARY KEY(gift);
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#));
A quick way to determine whether a column can contain a NULL value is to issue the ____________________ command, followed by the table name.
DESC
Which command can be used to determine whether or not a column is allowed to contain a NULL value?
DESCRIBE
Which clause will allow you to disable a constraint?
DISABLE
The ____________________ clause of the ALTER TABLE command must be used to drop an existing constraint.
DROP
Which clause will allow you to delete a constraint?
DROP
The REFERENCE constraint is used to ensure that a data value meets a specified condition before a record is added to a table. _________________________
FALSE
In a "one-to-many" relationship, which constraint is usually added to the "many" table?
FOREIGN KEY
Which keywords identify a column that, if it contains a value, it must match data contained in another table?
FOREIGN KEY
Which of the following types of constraints is used to enforce referential integrity?
FOREIGN KEY
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
A constraint name can consist of up to 25 characters and numbers. _________________________
false
A foreign key constraint can only be created at the column level.
false
A constraint is always enforced at the table level.
true
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) NOT NULL constraint is a special CHECK constraint with the condition of IS NOT NULL. _________________________
true
A(n) constraint can be created during the creation of a database table or added to a table afterwards. _________________________
true
The ALTER TABLE command with the ENABLE clause can be used to enable a constraint.
true
When dropping a(n) PRIMARY KEY constraint, the name of the column does not need to be included in the ALTER TABLE command. _________________________
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
Unless a PRIMARY KEY or a(n) ____________________ constraint is being dropped, the actual name assigned to the constraint must be included in the ALTER TABLE command.
UNIQUE
The ____________________ view can be used to list the names of the constraints that exist for all tables owned by the user.
USER_CONSTRAINTS
A constraint can be added to a table after the table has been populated with data even if the existing data violates the constraint.
false
Any constraint can be created at the table or the column level.
false
If a(n) FOREIGN KEY constraint has been created for a table, it means the data values in that column must be unique and cannot contain NULL values. _________________________
false
In the USER_CONSTRAINTS view, the constraint type for a NOT NULL constraint will be listed as N. _________________________
false
In the USER_CONSTRAINTS view, the constraint type for a PRIMARY KEY constraint will be listed as PK.
false
The FOREIGN KEY constraint is usually placed on the "one" side of a one-to-many relationship. _________________________
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 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 is the standard abbreviation for the constraint FOREIGN KEY?
fk
A CHECK constraint requires that a data value meet a certain condition before the record is added to the database table.
true
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 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(n) UNIQUE constraint will allow NULL values to be stored in the designated column. _________________________
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
If a data value violates a(n) constraint, the entire row is prevented from being added to the table. _________________________
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 can be used to delete an existing constraint. _________________________
true
The ALTER TABLE command can be used to disable a constraint.
true
Structure of the PROMOTION table Which of the following commands will add a UNIQUE constraint to the MINRETAIL column of the PROMOTION table?
ALTER TABLE promotion ADD CONSTRAINT orderitems_minretail_uk UNIQUE (minretail);
The ____________________ keywords can be added to the end of the command that creates a FOREIGN KEY constraint to indicate that when a row is deleted from the parent table that is referenced by entries in the child table, the rows in the child table should also be deleted.
ON DELETE CASCADE
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
In the USER_CONSTRAINTS view, the value displayed in the CONSTRAINT_TYPE column will be a(n) ____ for a CHECK constraint.
c