A company named Rel Inc. has many authorized dealers across the country who sell their products.
The Sales Manager of the company wants to see the details of the authorized dealers, including the
name, region, and total sales in ascending order of sales. Which of the following queries should be
issued to get the desired output?
A.
SELECT MAX (Totalsales)
FROM Dealer
B.
SELECT
FROM Dealer
C.
SELECT *
FROM Dealer
WHERE MAX (Totalsales)
D.
SELECT Name, Region, Totalsales
FROM Dealer
ORDER BY Totalsales
Explanation:
The first part of the query (i.e. SELECT Name, Region, Totalsales) selects the Name, Region, and
Totalsales attributes. The second part (i.e.
FROM Dealer) specifies the table name, and the third part (i.e. ORDER BY Totalsales) gives Totalsales
in ascending order. In the ORDER BY
clause, ascending is the default order.
Answer B is incorrect. The SELECT clause does not specify the attributes.
Answer A is incorrect. The query fails to provide the details from the table. It will provide only the
maximum sales from the table.
Answer C is incorrect. MAX is an aggregate function. An aggregate function cannot be in the WHERE
clause.