SQL Questions and Answers – SQL Min and Max Functions

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

Answer: c
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

Answer: b
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

Answer: a
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.
advertisement
advertisement

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

Answer: b
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

Answer: c
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

Answer: c
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

Answer: b
Explanation: MIN or MAX functions have only one argument. We can find maximum or minimum value of only one field by using one function.
advertisement

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

Answer: a
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

Answer: c
Explanation: Max( ) function returns maximum value of the selected column. Syntax for using Max( ) function:

advertisement
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

Answer: b
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.