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 is the SQL Renaissance Ambassador. He is on a mission to introduce developers to the evolution of SQL in the 21st century. Markus can be hired as trainer, speaker and consultant via winand.at.

Buy his 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 any size.
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