SQL Subquery And Transactions MCQ
Subquery And Transactions MCQs : This section focuses on the "Subquery And Transactions" of the SQL. These Multiple Choice Questions (mcq) should be practiced to improve the SQL skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.
1. Which of the following statements are TRUE regarding subqueries?
A. A subquery can retrieve zero or more rows
B. A subquery can appear on either side of a comparison operator
C. There is no limit on the number of subquery levels in the WHERE clause of a SELECT statement
D. Both A and B
View Answer
Ans : D
Explanation: Both A and B statements are TRUE regarding subqueries.
2. Which of the following statement(s) is TRUE regarding subqueries?
A. Inner queries in WHERE clause can contain ORDER BY
B. Outer query and inner query can get data from different tables
C. Outer query and inner query must get data from the same table
D. Inner queries cannot contain GROUP BY clause
View Answer
Ans : B
Explanation: Outer query and inner query can get data from different tables statement(s) is TRUE regarding subqueries.
3. Which ACID property specifies that once the transaction is committed, its permanent even in case of power failures?
A. Atomicity
B. Consistency
C. Isolation
D. Durability
View Answer
Ans : D
Explanation: Durability property specifies that once the transaction is committed, its permanent even in case of power failures
4. Where subqueries can not be used?
A. Field names in the SELECT statement
B. The WHERE clause only in the SELECT statement
C. The WHERE clause in SELECT as well as all DML statements
D. The FROM clause in the SELECT statement
View Answer
Ans : B
Explanation: The WHERE clause only in the SELECT statement.
5. Select * from student join takes using (ID); The above query is equivalent to ____________
A. Select * from student inner join takes using (ID);
B. Select * from student outer join takes using (ID);
C. Select * from student left outer join takes using (ID);
D. All of the mentioned
View Answer
Ans : A
Explanation: Join can be replaced by inner join.
6. The ______ construct returns true if a given tuple is present in the subquery.
A. not exists
B. present
C. not present
D. exists
View Answer
Ans : D
Explanation: The exists construct returns true if a given tuple is present in the subquery. The not exists construct gives true if a given tuple is not present in the subquery.
7. What is a correlated sub-query?
A. An independent query that uses the correlation name of another independent query.
B. A sub-query that uses the correlation name of an outer query
C. A sub-query that substitutes the names of the outer query
D. A sub-query that does not depend on its outer query's correlation names
View Answer
Ans : B
Explanation: A correlated sub-query is the one that uses the correlation name of an outer query.
8. SQL subqueries that can occur wherever a value is permitted provided the subquery gives only one tuple with a single attribute are called _________
A. Exact Subqueries
B. Vector Subqueries
C. Positive Subqueries
D. Scalar Subqueries
View Answer
Ans : D
Explanation: SQL subqueries that can occur wherever a value is permitted provided the subquery gives only one tuple with a single attribute are called Scalar subqueries. Scalar Subqueries can be used in the SQL update statement when they are used under the set clause.
9. A transaction that has not been completed successfully is called as _______
A. Compensating transaction
B. Aborted transaction
C. Active transaction
D. Partially committed transaction
View Answer
Ans : B
Explanation: Aborted transaction is a state after the transaction has been rolled back and the database has been restored to the state prior to the transaction.
10. The scheme that controls the interaction between executing transactions is called as _____
A. Concurrency control scheme
B. Multiprogramming scheme
C. Serialization scheme
D. Schedule scheme
View Answer
Ans : A
Explanation: The scheme that controls the interaction between executing transactions is called as concurrency control scheme.
Also check :
Discussion