This set of SQL Multiple Choice Questions & Answers (MCQs) focuses on “SQL Min and Max Functions”.
1. Which of the following terms is used to get the smallest value of the selected field?
a) Small( )
b) Smallest( )
c) Min( )
d) Minimum( )
View Answer
Explanation: Min( ) is an aggregate function. This function returns the smallest value of the selected column. It is used with several different data types.
2. Which function is used to find out the record with maximum value among a record set?
a) Maximum( )
b) Max( )
c) Large( )
d) Largest( )
View Answer
Explanation: Max( ) is an aggregate function. Using this function, we can get the maximum value of the selected field. It can be used with different data types.
3. When a date field is used in min( ) function, it returns _________
a) Earliest date
b) Date with latest day irrespective of month and year
c) Latest date
d) Date with earliest day irrespective of month and year
View Answer
Explanation: MIN( ) function is used to find out the record with minimum value among a record set. It returns the lowest number, earliest date, or non-numerical value as close alphabetically to “A” as possible.
4. If min( ) function is used on a field with non-numerical values, the function returns that record which is _________
a) Closest to alphabet Z
b) Closest to alphabet A
c) Closer to the previous field value
d) Closer to the next field value
View Answer
Explanation: MIN( ) function returns the smallest value of the selected column. If a non-numerical value field is used in min function, it returns the record which is closest to alphabet A.
5. When a date field is used with max( ) function, it returns _________
a) Earliest date
b) Date with latest month irrespective of day and year
c) Latest date
d) Date with earliest month irrespective of day and year
View Answer
Explanation: Max( ) function returns maximum value of the selected column. It returns the latest date among the given date field.
6. If a non-numerical values field is used in max( ) function, it returns that record which _________
a) Comes first when the field values are arranged in alphabetical order
b) Closer to the previous field value
c) Comes first when the field values are arranged in reverse alphabetical order
d) Closer to the next field value
View Answer
Explanation: MAX( ) function is used to find out the record with maximum value among a record set. It returns the record which is closest to alphabet Z when a non-numerical value field is used in max function.
7. How many arguments does a MIN or MAX function can have?
a) Zero
b) One
c) Should specified by the user
d) Two
View Answer
Explanation: MIN or MAX functions have only one argument. We can find maximum or minimum value of only one field by using one function.
8. What is the syntax to get minimum value of a field?
a) Select min(column_name) from table_name Where condition(s);
b) Select minimum(column_name) from table_name Where condition(s);
c) Select column_name from table_name Where min(column_name);
d) Select min( ) column_name from table_name Where condition(s);
View Answer
Explanation: Min( ) is used to get minimum value of selected column. Syntax for using Min( ) function:
SELECT MIN(column_name) FROM TABLE_NAME WHERE condition(s);
9. What is the syntax to get maximum value of a field?
a) Select large(column_name) from table_name Where condition(s);
b) Select column_name from table_name Where max (column_name);
c) Select max(column_name) from table_name Where condition(s);
d) Select max( ) column_name from table_name Where condition(s);
View Answer
Explanation: Max( ) function returns maximum value of the selected column. Syntax for using Max( ) function:
SELECT MAX(column_name) FROM TABLE_NAME WHERE condition(s);
10. Max and MIN functions cannot be used at a time in a single Select statement.
a) True
b) False
View Answer
Explanation: Max and min functions can be used in a single select statement. To get maximum and minimum values of a field using single select statement, this syntax is used:
SELECT MAX (column_name), MIN(column_name) FROM TABLE_NAME WHERE condition(s);
Sanfoundry Global Education & Learning Series – SQL.
To practice all areas of SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.