MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?
A
SELECT * FROM Items ORDER BY Price ASCENDING
B
SELECT * FROM Items ORDER BY Price ASC
C
SELECT * FROM Items BY Price LOWEST TO HIGHEST
D
SELECT * FROM Items ORDER BY Price DESC
Explanation: 

Detailed explanation-1: -The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.

Detailed explanation-2: -To find the minimum value of a column, use the MIN() aggregate function; it takes as its argument the name of the column for which you want to find the minimum value. If you have not specified any other columns in the SELECT clause, the minimum will be calculated for all records in the table.

Detailed explanation-3: -With SQL, how can you return all the records from a table named “Persons” sorted descending by “FirstName”? Explanation: The SQL SELECT statement queries data from tables in the database.

Detailed explanation-4: -The MAX() function returns the largest value of the selected column.

There is 1 question to complete.