A(n) _____ is a query that is embedded (or nested) inside another query.
Select one:
a. operator
b. subquery
c. alias
d. view
If a subquery returns list of values, which operator can be used in the outer query predicate?
Select one:
a. >
b. <
c. IN
d. =
Which query returns a list of all products with a price greater than or equal to the average product price?
Select one:
a.
SELECT P_CODE,MAX(AVG(P_PRICE))
FROM PRODUCT
GROUP BY P_CODE;
b.
SELECT P_CODE, P_PRICE
FROM PRODUCT
WHERE P_PRICE >= (SELECT AVG(P_PRICE) FROM PRODUCT)
GROUP BY P_CODE;
c.
SELECT P_CODE, P_PRICE
FROM PRODUCT
WHERE P_PRICE >= AVG(P_PRICE);
d.
SELECT P_CODE, P_PRICE
FROM PRODUCT
WHERE P_PRICE >= (SELECT AVG(P_PRICE) FROM PRODUCT);
Rows can be grouped into smaller collections quickly and easily using the _____ clause within the SELECT statement.
Select one:
a. WHERE
b. FROM
c. GROUP BY
d. JOIN
SELECT statement may use subqueries within ____ clauses
Select one or more:
a. WHERE
b. HAVING
c. FROM
d. IN
IN SQL language
Question 1:
Correct Answer: b
Explanation:
The subquery is a query which is nested in the other query by using IN operator.
So, only the option 'b' is correct option.
Question 2:
Correct Answer: c
Explanation:
The subquery is a query which is nested in the other query by using IN operator.
So, only the option 'c' is correct option.
Question 3:
Correct Answer: b
Explanation:
The option 'b' select the desired query result because the subquery find the average price and then the main query find the P_CODE which are above or equal to the average price.
So, only the option 'b' is correct.
Question 4:
Correct Answer: c
Explanation:
The 'Group By' clause is used to group the row.
So, option 'c' is correct.
Question 5:
Correct Answer: d
Explanation:
The subquery is a query which is nested in the other query by using IN operator.
So, only the option 'd' is correct option.
Get Answers For Free
Most questions answered within 1 hours.