SQL INTERVIEW QUESTION & ANSWERS
41. |
What is subquery? |
|
Query within a query is called a subquery. The statement containing a subquery is called the parent statement. Subqueries are used to retrieve data from tables and the retrieved data depends on the value in the table itself. |
42. |
What are the types of subqueries? |
|
- Single row sub query
-
Multiple row sub query
-
Multiple column subquery
-
Correlated sub query
|
43. |
What is single row subquery? |
|
Single row subqueries return only one row as a result. The operators that can be used with single row subqueries are =, >. >=, <, <=, and <>. |
44. |
What is the use of distinct keywords? |
|
The DISTINCT keyword is used to return only distinct (different) values. |
45. |
What is multiple row subquery? |
|
The subquery that returns multiple rows is called a multiple-row subquery. you need to use the comparison operators IN, ALL, and ANY to handle the multiple rows returned by the subquery. |