MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

SQL

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
SELECT MAX(price)FROM PRODUCTwill return how many rows?
A
1
B
0
C
2
D
As many rows that are in the table
Explanation: 

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

Detailed explanation-2: -We used the MAX() function within a subquery to find the maximum value, and returned the whole row with the outer query.

Detailed explanation-3: -Discussion: To find the maximum value of a column, use the MAX() aggregate function; it takes a column name or an expression to find the maximum value. In our example, the subquery returns the highest number in the column grade (subquery: SELECT MAX(grade) FROM student ).

Detailed explanation-4: -The SQL COUNT() function returns the number of rows in a table satisfying the criteria specified in the WHERE clause. It sets the number of rows or non NULL column values. COUNT() returns 0 if there were no matching rows.

There is 1 question to complete.