1Z0-006 Database Objects and Constraints 1 — Questions and Answers
Question 1: Which Oracle constraint ensures that a column value cannot be NULL?
- NOT NULL (Correct answer)
- UNIQUE
- CHECK
- DEFAULT
Correct answer: NOT NULL
The NOT NULL constraint prevents a column from accepting NULL values, ensuring every row has a value for that column.
Question 2: Which constraint ensures that each value in a column is unique across the table but still allows NULL values?
- PRIMARY KEY
- NOT NULL
- UNIQUE (Correct answer)
- CHECK
Correct answer: UNIQUE
The UNIQUE constraint ensures no two rows have the same non-NULL value in the constrained column, but unlike PRIMARY KEY, it permits NULL values.
Question 3: What is the primary purpose of a FOREIGN KEY constraint in Oracle Database?
- To ensure all values are distinct within a column
- To enforce referential integrity between two tables (Correct answer)
- To limit the range of values in a column
- To prevent NULL values in a column
Correct answer: To enforce referential integrity between two tables
A FOREIGN KEY constraint enforces referential integrity by ensuring values in the child table's column match existing values in the referenced parent table's primary key.
Question 4: Which constraint type allows you to specify a condition that every row's column value must satisfy?
- NOT NULL
- UNIQUE
- FOREIGN KEY
- CHECK (Correct answer)
Correct answer: CHECK
The CHECK constraint defines a condition that must evaluate to TRUE for every row, letting you restrict which values are accepted in a column.
Question 5: Which statement about the PRIMARY KEY constraint is correct?
- A table can have multiple PRIMARY KEY constraints
- PRIMARY KEY columns allow NULL values
- A PRIMARY KEY uniquely identifies each row and does not allow NULLs (Correct answer)
- PRIMARY KEY constraints can only be defined at the column level
Correct answer: A PRIMARY KEY uniquely identifies each row and does not allow NULLs
A PRIMARY KEY constraint combines NOT NULL and UNIQUE, ensuring the primary key column(s) uniquely identify each row and contain no NULL values.
Question 6: What is a composite primary key in Oracle Database?
- A primary key that references multiple tables
- A primary key made up of two or more columns (Correct answer)
- A primary key that allows NULL values in one column
- A primary key created automatically by Oracle
Correct answer: A primary key made up of two or more columns
A composite primary key consists of two or more columns whose combined values must be unique across all rows in the table.
Question 7: When a FOREIGN KEY constraint with ON DELETE CASCADE is defined, what happens when a parent row is deleted?
- The deletion is rejected if child rows exist
- The child rows are set to NULL
- The child rows are automatically deleted (Correct answer)
- The child rows are moved to an archive table
Correct answer: The child rows are automatically deleted
ON DELETE CASCADE causes Oracle to automatically delete all child rows that reference the deleted parent row, propagating the deletion down the relationship.
Which Oracle constraint ensures that a column value cannot be NULL?