Q1
True / FalseIn Oracle, a CHECK constraint is used to enforce a condition on each row in a table.
A CHECK constraint is used to ensure that all values in a column meet a specific condition.
Q2
True / FalseA CHECK constraint in Oracle can only be applied to a single column in a table.
A CHECK constraint can be applied to multiple columns in a table by specifying a condition that involves more than one column.
Q3
True / FalseIn Oracle, a CHECK constraint can be added to a table at the time of table creation using the CREATE TABLE statement.
You can define a CHECK constraint at the time of table creation within the CREATE TABLE statement.
Q4
True / FalseIn Oracle, the ALTER TABLE statement can be used to add a CHECK constraint to an existing table.
The ALTER TABLE statement can be used to add a CHECK constraint to an existing table using the ADD CONSTRAINT clause.
Q5
True / FalseIn Oracle, a CHECK constraint cannot reference other tables or columns outside of the table it is defined on.
A CHECK constraint in Oracle can only reference columns within the same table and cannot reference columns in other tables.
Q6
True / FalseIn Oracle, the CHECK constraint can include functions and expressions.
The CHECK constraint can include functions and expressions to enforce more complex conditions on the data.
Q7
True / FalseIn Oracle, if a CHECK constraint condition fails during an INSERT or UPDATE operation, the operation will still succeed but will generate a warning.
If a CHECK constraint condition fails, the INSERT or UPDATE operation will fail and generate an error, not a warning.
Q8
True / FalseIn Oracle, a disabled CHECK constraint will still be enforced during data modifications.
If a CHECK constraint is disabled, it will not be enforced during data modifications until it is enabled again.
Q9
True / FalseIn Oracle, a CHECK constraint can be defined using the USING INDEX clause to specify an index for fast validation.
The USING INDEX clause is used for unique and primary key constraints to specify an index, not for CHECK constraints.
Q10
True / FalseThe Oracle Certified Professional (OCP) exam includes knowledge on creating, managing, and optimizing CHECK constraints in database tables.
The OCP certification covers advanced topics, including the creation, management, and optimization of CHECK constraints to ensure data integrity in Oracle databases.
Q13
Single ChoiceWhich of the following is the correct syntax to create a table in Oracle with a CHECK constraint that ensures the SALARY column has values between 1000 and 10000?
The correct syntax to include a CHECK constraint in the CREATE TABLE statement in Oracle is to use CONSTRAINT chk_salary CHECK (SALARY BETWEEN 1000 AND 10000).
Q15
Single ChoiceGiven the following Oracle SQL code, which of the following will result in an error when trying to insert a row?
SQL Code
CREATE TABLE PRODUCTS (
PRODUCT_ID NUMBER PRIMARY KEY,
PRODUCT_NAME VARCHAR2(100),
PRICE NUMBER,
CONSTRAINT chk_price CHECK (PRICE > 0)
);
The CHECK constraint chk_price enforces that the PRICE must be greater than 0. An attempt to insert a PRICE of 0 will result in an error.
Q19
Single ChoiceHow can you ensure in Oracle that a column GRADE in the STUDENTS table only contains values 'A', 'B', 'C', 'D', or 'F'?
The CHECK constraint ensures that the GRADE column only contains the specified valid values: 'A', 'B', 'C', 'D', or 'F'.