Can I use… T617, “FIRST_VALUE and LAST_VALUE functions”


Apache DerbyBigQueryabadDb2 (LUW)acaeH2MariaDBaaMySQLOracle DBPostgreSQLaaSQL ServerSQLiteaafirst_value() [respect nulls]first_value()   ignore nulls last_value() [respect nulls]last_value()   ignore nulls 
  1. No explicit respect nulls clause
  2. Non-standard alternative: first_value(<expr> ignore nulls)
  3. Non-standard alternative: first_value(<expr>, 'ignore nulls')
  4. Non-standard alternative: last_value(<expr> ignore nulls)
  5. Non-standard alternative: last_value(<expr>, 'ignore nulls')

Normative References

T617, “FIRST_VALUE and LAST_VALUE functions” is defined as optional feature in ISO/IEC 9075:2016-2. It first appeared in SQL:2011.0

About the Author

Photo of Markus Winand

Markus Winand provides insights into SQL and shows how different systems support it at modern-sql.com. Previously he made use-the-index-luke.com, which is still actively maintained. Markus can be hired as trainer, speaker and consultant via winand.at.

Buy the Book

Cover of “SQL Performance Explained”: Squirrel running on grass

The essence of SQL tuning in 200 pages

Buy now!
(paperback and/or PDF)

Paperback also available at Amazon.com.

Hire Markus

Markus offers SQL training and consulting for developers working at companies of all sizes.
Learn more »

Footnotes

  1. See What’s new in SQL:2011.

Connect with Markus Winand

Markus Winand on LinkedInMarkus Winand on XINGMarkus Winand on Twitter
“modern SQL” by Markus Winand is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License.
Legal | Contact | NO WARRANTY | Trademarks | Privacy and GDPR | CC-BY-NC-ND 3.0 license