---
title: "SQL max function ideas to use correctly"
description: "SQL max function explained using best example"
url: https://srinimf.com/2015/08/20/db2-max-column-function-best-example/
date: 2015-08-20
modified: 2026-10-10
author: "Srini"
categories: ["DB2"]
tags: ["DB2 MAX scalar function example", "SQL Max function"]
type: post
lang: en
---

# SQL max function ideas to use correctly

The MAX function ***returns the largest value*** in the specified column or expression. The following SQL statement determines the project with the latest end date:

SELECT MAX(ACENDATE)

FROM DSN81010.PROJACT;

Related[How to Use DIGITS function to get Digits from Decimal Column Value](https://srinimf.com/2017/07/19/db2-digitis-function-example/)

**Points to remember**

- The result of the MAX function is of the ***same data type*** as the column or expression on which it operates.

- The argument of the MAX function can be of **any built-in data type** other than CLOB, DBCLOB, BLOB, ROWID, or XML.

**[5 Top+features + of+ MongoDb (1 of 5)](http://www.biganalytics.me/2015/08/5-top-features-of-mongodb-1-of-5.html)**

Related[DB2 Indexes Type 1 Vs. Type 2](https://srinimf.com/2010/07/24/db2-index/)

Character string arguments **can be no longer 255** bytes and graphic string arguments can be no longer than **127 bytes.**

Best example for MAX salary:

SELECT MAX(SALARY)

FROM DSN81010.EMP

WHERE WORKDEPT = ‘D21’

AND SEX = ‘M’;

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2015%2F08%2F20%2Fdb2-max-column-function-best-example%2F&media=https%3A%2F%2Fi0.wp.com%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2026%2F02%2Fcropped-logo.png%3Ffit%3D96%252C96%26ssl%3D1&description=SQL%20max%20function%20ideas%20to%20use%20correctly)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2015/08/20/db2-max-column-function-best-example/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2015/08/20/db2-max-column-function-best-example/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2015/08/20/db2-max-column-function-best-example/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2015/08/20/db2-max-column-function-best-example/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20SQL%20max%20function%20ideas%20to%20use%20correctly&body=https%3A%2F%2Fsrinimf.com%2F2015%2F08%2F20%2Fdb2-max-column-function-best-example%2F&share=email)
-

### Like this:

Like Loading…
