How to use SQL PIVOT to Compare Two Tables in Your Database

This can happen ever so easily. You adapt a table by adding a new column: ALTER TABLE payments ADD code NUMBER(3); You go on, implementing your business logic - absolutely no problem. But then, later on (perhaps in production), some batch job fails because it makes some strong assumptions about data types. Namely, it assumes … Continue reading How to use SQL PIVOT to Compare Two Tables in Your Database

How 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: https://twitter.com/ModernSQL/status/570294338124697600 Is it true? Yes it is, in the SQL standard and in a variety of standards-compliant databases. But let's check what jOOQ does when you run the following program on all 18 currently supported … Continue reading How to Extract a Date Part in SQL

jOOQ vs. Slick – Pros and Cons of Each Approach

Every framework introduces a new compromise. A compromise that is introduced because the framework makes some assumptions about how you'd like to interact with your software infrastructure. An example of where this compromise has struck users recently is the discussion "Are Slick queries generally isomorphic to the SQL queries?". And, of course, the answer is: … Continue reading jOOQ vs. Slick – Pros and Cons of Each Approach

Thou Shalt Not Name Thy Method “Equals”

(unless you really override Object.equals(), of course). I've stumbled upon a rather curious Stack Overflow question by user Frank: Why does Java's Area#equals method not override Object#equals? Interestingly, there is a Area.equals(Area) method which really takes an Area argument, instead of a Object argument as declared in Object.equals(). This leads to rather nasty behaviour, as … Continue reading Thou Shalt Not Name Thy Method “Equals”

jOOQ Tuesdays: Raoul-Gabriel Urma Explores What Java 8 and English have in Common

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. This includes people who work with SQL, Java, Open Source, and a variety of other related topics. We have the pleasure … Continue reading jOOQ Tuesdays: Raoul-Gabriel Urma Explores What Java 8 and English have in Common

10 SQL Articles Everyone Must Read

We've been blogging about Java and SQL for a while now, on the jOOQ blog. Over the years, while researching interesting blog topics, we've discovered a lot of SQL gems in the blogosphere that have inspired our work and our passion for SQL. Today, we're presenting to you a list of 10 articles that we … Continue reading 10 SQL Articles Everyone Must Read

Top 10 Easy Performance Optimisations in Java

There has been a lot of hype about the buzzword "web scale", and people are going through lengths of reorganising their application architecture to get their systems to "scale". But what is scaling, and how can we make sure that we can scale? Different aspects of scaling The hype mentioned above is mostly about scaling … Continue reading Top 10 Easy Performance Optimisations in Java

Still 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 of the popular book SQL Performance Explained has recently given a very well-researched talk about modern SQL. We particularly like his … Continue reading Still Using Windows 3.1? So why stick to SQL-92?

Top 5 Use-Cases For Nested Types

There has been an interesting discussion on reddit, the other day Static Inner Classes. When is it too much? First, let's review a little bit of basic historic Java knowledge. Java-the-language offers four levels of nesting classes, and by "Java-the-language", I mean that these constructs are mere "syntax sugar". They don't exist in the JVM, … Continue reading Top 5 Use-Cases For Nested Types