1.
WHERE clauses allows alias names.
Correct Answer
B. False
Explanation
WHERE clauses in SQL do not allow alias names. Alias names can only be used in SELECT statements to give columns or tables alternative names. The WHERE clause is used to filter rows based on specific conditions, and it does not support the use of alias names.
2.
_________ constraint is used to limit the value range that can be placed in a column.
Correct Answer
Check
Explanation
The "Check" constraint is used to limit the value range that can be placed in a column. This constraint allows you to specify a condition that must be met in order for a value to be inserted or updated in the column. If the condition is not met, the database will throw an error and the operation will be rejected. This constraint is commonly used to enforce data integrity by ensuring that only valid values are stored in the column.
3.
Select the statement which is collectively known as TCL?
Correct Answer(s)
A. Commit
B. Savepoint
C. Rollback
Explanation
Commit, Savepoint, and Rollback are collectively known as Transaction Control Language (TCL) statements in database management systems.
Commit is used to permanently save the changes made in a transaction, making them a permanent part of the database. Savepoint allows for creating a point in a transaction where you can roll back to if needed. Rollback is used to undo the changes made in a transaction and restore the database to its previous state. Grant, on the other hand, is a Data Control Language (DCL) statement used to grant privileges to users in a database.
4.
Constraints are classified into _________ and __________ constraints.
Correct Answer(s)
A. Column level
B. Table level
Explanation
Constraints in a database are rules or conditions that are applied to the data to ensure its integrity and consistency. In this context, column level constraints are rules that are applied to individual columns in a table, such as data type, nullability, and uniqueness constraints. On the other hand, table level constraints are rules that are applied to the entire table, such as primary key, foreign key, and check constraints. Therefore, constraints are classified into column level and table level constraints based on the scope of their application.
5.
You can drop a column in a table with a simple ALTER TABLE DROP COLUMN statement, even if the column is referenced in a constraint.
Correct Answer
B. False
Explanation
The given statement is false. If a column is referenced in a constraint, you cannot drop that column directly using the ALTER TABLE DROP COLUMN statement. You would need to first drop or modify the constraint that references the column before being able to drop the column itself.
6.
All of a user's constraints can be viewed in the Oracle Data Dictionary view called:
Correct Answer
B. USER_CONSTRAINTS (*)
Explanation
The correct answer is USER_CONSTRAINTS. The Oracle Data Dictionary view called USER_CONSTRAINTS allows users to view all of their constraints. This view provides information about the constraints defined on tables owned by the current user. It includes details such as constraint name, type, table name, and the columns involved in the constraint. By querying this view, users can easily access and manage their constraints in the Oracle database.
7.
What mechamisn does Oracle use in the background to enforce uniqueness in Primary and Unique key constraints?
Correct Answer
A. Unique indexes are created in the background by Oracle when Primary and Unique constraints are created or enabled (*)
Explanation
Oracle uses unique indexes in the background to enforce uniqueness in Primary and Unique key constraints. When Primary and Unique constraints are created or enabled, Oracle automatically creates unique indexes to ensure that the values in the specified columns are unique. These indexes help Oracle enforce the uniqueness constraint efficiently by providing a fast lookup mechanism for duplicate values.
8.
The command to 'switch off' a constraint is:
Correct Answer
B. ALTER TABLE DISABLE CONSTRAINT (*)
Explanation
The correct answer is "ALTER TABLE DISABLE CONSTRAINT (*)". This command is used to disable a constraint in a table. The asterisk (*) represents the name of the constraint that needs to be disabled. By using this command, the constraint will no longer be enforced, allowing for modifications to be made to the table without the constraint being checked.
9.
Once constraints have been created on a table you will have to live with them as they are unless you drop and re-create the table.
Correct Answer
B. False
Explanation
Constraints on a table can be altered or dropped using the ALTER TABLE statement in SQL. This allows for modifications to the existing constraints without having to drop and recreate the entire table. Therefore, the statement that once constraints have been created on a table, they cannot be changed or modified is false.
10.
The SQL WHERE clause:
Correct Answer
B. Limits the row data are returned.
Explanation
The SQL WHERE clause is used to filter rows based on a specified condition. It allows you to specify a condition that must be met for a row to be included in the result set. Therefore, it limits the row data that is returned, not the column data. So, the correct answer is "limits the row data are returned."
11.
Which of the following is valid SQL for an Index?
Correct Answer
A. CREATE INDEX ID;
Explanation
The correct answer is "CREATE INDEX ID;". This is valid SQL syntax for creating an index in a database. The other options, "CHANGE INDEX ID;", "ADD INDEX ID;", and "REMOVE INDEX ID;", do not exist in SQL syntax and are therefore not valid.
12.
To remove duplicate rows from the results of an SQL SELECT statement, the ________ qualifier specified must be included.
Correct Answer
C. DISTINCT
Explanation
To remove duplicate rows from the results of an SQL SELECT statement, the "DISTINCT" qualifier must be included. This qualifier ensures that only unique values are returned, eliminating any duplicate rows in the result set.
13.
There is a possibility to create more than one primary key on a single table
Correct Answer
A. True
Explanation
It is not possible to create more than one primary key on a single table. A primary key is a unique identifier for each record in a table, and by definition, there can only be one primary key. However, it is possible to have a composite primary key, which consists of multiple columns that together form a unique identifier. This is different from having multiple primary keys.
14.
Check constraint can be used for self refential integrity
Correct Answer
A. True
Explanation
A check constraint is a rule that is applied to a column or a set of columns in a table to enforce the data integrity. It allows you to specify a condition that must be met for the data to be inserted or updated in the table. In the context of self-referential integrity, a check constraint can be used to ensure that a column referencing another column in the same table is valid. This means that the value in the referencing column must exist in the referenced column. Therefore, the statement "Check constraint can be used for self-referential integrity" is true.
15.
Syntax for Referential integrity?
Correct Answer(s)
A. Foreign key(field_name)references table_name(field_name)
C. Foreign key(field_name)references table_name(field_name) on delete cascade
Explanation
The correct answer is "foreign key(field_name)references table_name(field_name),foreign key(field_name)references table_name(field_name) on delete cascade". This is because the syntax for referential integrity includes the "foreign key" keyword followed by the name of the field, then the "references" keyword followed by the name of the table and the name of the field that the foreign key references. The second part of the answer includes the "on delete cascade" clause, which means that if a record in the referenced table is deleted, all the records in the table with the foreign key will also be deleted.
16.
An automatic COMMIT occurs when:
Correct Answer(s)
A. DDL statement is issued
B. DCL statement is issued
C. Normal exit from SQL*PLUS without issuing explicit COMMIT or ROLLBACK
Explanation
An automatic COMMIT occurs when a DDL statement is issued, a DCL statement is issued, or there is a normal exit from SQL*PLUS without issuing an explicit COMMIT or ROLLBACK.
17.
Zero is equivalent to null?
Correct Answer
B. False
Explanation
Zero is not equivalent to null. Zero is a numerical value that represents the absence of quantity or value, while null is a special value that represents the absence of any object or reference. They are different concepts and cannot be considered equivalent.
18.
When two users access the same table's specific row simultaneously , it is possible to update the data before one commits
Correct Answer
B. False
Explanation
When two users access the same table's specific row simultaneously, it is not possible to update the data before one commits. This is because most database systems implement locking mechanisms to ensure that only one user can modify a specific row at a time. This prevents conflicts and maintains data integrity. Therefore, the statement is false.
19.
Which statement cannot be rolled back and committed automatically
Correct Answer
A. DDL
Explanation
DDL stands for Data Definition Language and is used to define and manage the structure of a database. It includes commands like CREATE, ALTER, and DROP. These commands are used to create, modify, or delete database objects like tables, indexes, and views. Unlike DML (Data Manipulation Language) and TCL (Transaction Control Language), DDL statements cannot be rolled back and committed automatically. Once a DDL statement is executed, the changes made to the database structure are permanent and cannot be undone using a rollback operation.
20.
Which are the types of locks?
Correct Answer
C. Automatic and manual
Explanation
The types of locks can be categorized as either automatic or manual. Automatic locks are those that operate electronically or automatically, such as keyless entry systems or smart locks. On the other hand, manual locks require physical manipulation, such as turning a key or sliding a bolt, to lock or unlock a door. Therefore, the correct answer is "automatic and manual" as it includes both types of locks.