Q1
True / FalseIn Oracle, a UNIQUE constraint ensures that all values in a column are distinct.
The UNIQUE constraint enforces the uniqueness of the values in a specified column, ensuring no duplicate values.
Q2
True / FalseA table in Oracle can have multiple UNIQUE constraints.
A table can have multiple UNIQUE constraints, each applied to different columns or sets of columns.
Q3
True / FalseA UNIQUE constraint in Oracle allows multiple NULL values in the column.
Unlike primary key constraints, UNIQUE constraints allow multiple NULL values in the column because NULLs are considered distinct from each other.
Q4
True / FalseIn Oracle, the UNIQUE constraint can be added to an existing table using the ALTER TABLE statement.
The UNIQUE constraint can be added to an existing table using the ALTER TABLE statement with the ADD CONSTRAINT clause.
Q5
True / FalseIn Oracle, a UNIQUE constraint automatically creates a unique index on the column.
When a UNIQUE constraint is defined, Oracle automatically creates a unique index on the column to enforce the constraint.
Q6
True / FalseIn Oracle, the UNIQUE constraint can only be applied to a single column in a table.
The UNIQUE constraint can be applied to a single column or a combination of columns (composite unique constraint) in a table.
Q7
True / FalseIn Oracle, a composite UNIQUE constraint can include columns of different data types.
A composite UNIQUE constraint can span multiple columns, which can be of different data types, to ensure the combined values are unique.
Q8
True / FalseIn Oracle, you can disable a UNIQUE constraint temporarily using the ALTER TABLE statement.
You can disable a UNIQUE constraint using the ALTER TABLE statement with the DISABLE CONSTRAINT clause and enable it again when needed.
Q9
True / FalseIn Oracle, the UNIQUE constraint can include a USING INDEX clause to specify an existing index for enforcing the constraint.
The USING INDEX clause allows you to specify an existing index to enforce the UNIQUE constraint, which can help optimize performance.
Q10
True / FalseThe Oracle Certified Professional (OCP) exam includes knowledge on creating, managing, and optimizing UNIQUE constraints in database tables.
The OCP certification covers advanced topics, including the creation, management, and optimization of UNIQUE constraints to ensure data integrity in Oracle databases.
Q12
Single ChoiceIn Oracle, which of the following SQL commands correctly defines a UNIQUE constraint on the EMAIL column in the EMPLOYEES table?
The UNIQUE constraint can be defined directly in the column definition as shown in option A, ensuring that all values in the EMAIL column are unique.
Q13
Single ChoiceWhich of the following SQL statements will cause a UNIQUE constraint violation in Oracle?
SQL Code
CREATE TABLE USERS (
USER_ID NUMBER PRIMARY KEY,
USERNAME VARCHAR2(50) UNIQUE,
EMAIL VARCHAR2(100) UNIQUE
);
INSERT INTO USERS (USER_ID, USERNAME, EMAIL)
VALUES (1, 'johndoe', 'john@example.com');
INSERT INTO USERS (USER_ID, USERNAME, EMAIL)
VALUES (2, 'johndoe', 'john@example.com');
The second INSERT statement will cause a UNIQUE constraint violation because both the USERNAME and EMAIL columns must have unique values, and the USERNAME value 'johndoe' is duplicated.
Q25
Multiple ChoiceSelect the SQL scripts that correctly enforce a UNIQUE constraint across multiple columns in Oracle.
A UNIQUE constraint can be applied to multiple columns to ensure that the combination of their values is unique across all rows. The correct scripts will demonstrate how to define this constraint.