Computer Science: Constraints

25 July 2022
4.7 (114 reviews)
123 test answers

Unlock all answers in this set

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