Subquery

Q: In which of the following clauses can a sub-query be used?
A: All of the listed options
Q: The ______ construct returns true if a given tuple is present in the subquery.
A: exists
Q: What will be the outcome of the following query? Consider the given table structure:EMPLOYEE_ID NOT NULL NUMBER(6)FIRST_NAME VARCHAR2(20)LAST_NAME NOT NULL VARCHAR2(25)EMAIL NOT NULL VARCHAR2(25)PHONE_NUMBER VARCHAR2(20)HIRE_DATE NOT NULL DATEJOB_ID NOT NULL VARCHAR2(10)SALARY NUMBER(8,2)COMMISSION_PCT NUMBER(2,2)MANAGER_ID NUMBER(6)DEPARTMENT_ID NUMBER(4)
SELECT first_name, last_name, salary
FROM employees
WHERE salary ANY (SELECT salary FROM employees);
A: It throws an error
Q: Which of the following single-row operators can be used for writing a sub-query?
A: All of the above mentioned
Q: You need to find the 3rd maximum salary from the 'employees' table. Which of the following queries will give you the required results? Choose the most appropriate answer.
A: SELECT * FROM employees E WHERE 3 = (SELECT count(distinct salary) FROM employees S WHERE S.salary > E.salary);
Q: What among the following is true about sub-queries?
A: Sub-queries can be written on either side of a comparison operator
Q: A subquery must be placed in the outer query's HAVING clause if:
A: The value returned by the inner query is to be compared to grouped data in the outer query.
Q: Which of the following is true about the result of a sub-query?
A: The result of a sub-query is used by the main query.
Q: Which of the following is true about sub-queries?
A: They execute before the main query executes.
Q: Below is an example of
SELECT a.EmployeeID
FROM HumanResources.Employee a
WHERE a.ContactID IN
(
SELECT b.ContactID
FROM Person.Contact b
WHERE b.Title = 'Mrs.'
)
A: Noncorrelated Subquery