Do You Really Understand SQL’s GROUP BY and HAVING clauses?
There are some things in SQL that we simply take for granted without thinking about them properly. One of these things are the GROUP BY and the less popular HAVING clauses. Let’s look at a simple...
View ArticleStill Using Windows 3.1? So why stick to SQL-92?
We’ve been blogging a lot about the merits of modern SQL on the jOOQ blog. Specifically, window functions are one of the most fascinating features. But there are many many others. Markus Winand, author...
View ArticleHow to Extract a Date Part in SQL
The Modern SQL Twitter account (by Markus Winand) published a hint about how to extract a date part in SQL: The right way to get a part of a date/time is: EXTRACT(YEAR FROM CURRENT_DATE) = 2015...
View ArticleUse this Neat Window Function Trick to Calculate Time Differences in a Time...
Whenever you feel that itch… Can’t I calculate this with SQL? The answer is: Yes you can! And you should! Let’s see how… Calculating time differences between rows Let’s consider the following database...
View ArticlejOOQ Tuesdays: Markus Winand is on a Modern SQL Mission
Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective....
View ArticlejOOQ Tuesdays: Glenn Paulley Gives Insight into SQL’s History
Welcome to the jOOQ Tuesdays series. In this series, we’ll publish an article on the third Tuesday every other month where we interview someone we find exciting in our industry from a jOOQ perspective....
View ArticleTop 10 SQL Dialect Emulations Implemented in jOOQ
The SQL standard is a nice thing. But it’s a standard. And as such, while it may provide good guidelines on how to implement some SQL features, most dialects deviate from it in one way or another...
View ArticleOracle’s OFFSET .. FETCH Can be Slower than Classic ROWNUM Filtering
One of Oracle 12c’s coolest features was the introduction of the SQL standard OFFSET .. FETCH clause, as we can now write things like: SELECT * FROM film ORDER BY film_id FETCH FIRST 1 ROW ONLY This is...
View ArticleUsing IGNORE NULLS With SQL Window Functions to Fill Gaps
I found a very interesting SQL question on Twitter recently: Hi @sfonplsql we have some scenario, Let us 01Jan Mkt Value 100, 02Jan 120, next entry available 25th Jan 125, from 3rd Jan 24 Jan, our...
View ArticleFunctional Dependencies in SQL GROUP BY
The SQL standard knows an interesting feature where you can project any functional dependencies of a primary (or unique) key that is listed in the GROUP BY clause without having to add that functional...
View Article