jOOQ 3.12 Released With a new Procedural Language API
jOOQ 3.12 has been released with a new procedural language API, new data types, MemSQL support, formal Java 11+ support, a much better parser, and reactive stream API support In this release, we’ve...
View ArticleQuantified LIKE ANY predicates in jOOQ 3.12
Quantified comparison predicates One of SQL’s weirdes features are quantified comparison predicates. I’ve hardly ever seen these in the wild: SELECT * FROM t WHERE id = ANY (1, 2, 3) The above example...
View ArticleUsing DISTINCT ON in Non-PostgreSQL Databases
A nice little gem in PostgreSQL’s SQL syntax is the DISTINCT ON clause, which is as powerful as it is esoteric. In a previous post, we’ve blogged about some caveats to think of when DISTINCT and ORDER...
View ArticleOracle’s BINARY_DOUBLE Can Be Much Faster Than NUMBER
Using the right data type for some calculation sounds like some obvious advice. There are many blogs about using temporal data types for temporal data, instead of strings. An obvious reason is data...
View ArticleWhat’s Faster? COUNT(*) or COUNT(1)?
One of the biggest and undead myths in SQL is that COUNT(*) is faster than COUNT(1). Or was it that COUNT(1) is faster than COUNT(*)? Impossible to remember, because there’s really no reason at all why...
View ArticleHow to Map MySQL’s TINYINT(1) to Boolean in jOOQ
MySQL 8 does not yet support the BOOLEAN type as specified in the SQL standard. There is a DDL “type” called BOOL, which is just an alias for TINYINT: create table t(b bool); select table_name,...
View ArticleA Quick Trick to Make a Java Stream Construction Lazy
One of the Stream APIs greatest features is its laziness. The whole pipeline is constructed lazily, stored as a set of instructions, akin to a SQL execution plan. Only when we invoke a terminal...
View ArticleHow to Simulate a Liquibase Migration using H2
This post is part of a new blog series about database migrations, which will cover a variety of database change management topics. In the near future, we’ll look much more into these topics, hoping to...
View ArticleDogfooding in Product Development
Dogfooding, or eating your own dog food, is a practice that all product developers should implement all the time. According to wikipedia: Dogfooding, occurs when an organization uses its own product....
View ArticleA Guide to SQL Naming Conventions
One of Java’s big strengths, in my opinion, is the fact that most naming conventions have been established by the creators of the language. For example: Class names are in PascalCase Member names are...
View ArticleStop Mapping Stuff in Your Middleware. Use SQL’s XML or JSON Operators Instead
It’s been a while since I’ve ranted on this blog, but I was recently challenged by a reddit thread to write about this topic, so here goes… So, you’re writing a service that produces some JSON from...
View ArticlejOOQ 3.13 Released with More API and Tooling for DDL Management
jOOQ 3.13 has been released with CockroachDB support, much more API and tooling for DDL management, and SQL:2011 temporal table support Starting with this release, we will further embrace our support...
View ArticleUse the jOOQ-Refaster Module for Automatic Migration off of Deprecated jOOQ API
Deprecation notice After encountering numerous problems building the jOOQ-refaster module in various JDK versions and after receiving no feedback from the community about this feature, we have decided...
View ArticleSQL DISTINCT is not a function
A very common misconception I often encounter with SQL users is the idea that DISTINCT is something like a function, and that it can take parenthesised arguments. Just recently, I’ve seen this Stack...
View Article5 Ways to Better Understand SQL by Adding Optional Parentheses
It appears that our recent beginner SQL articles explaining SQL syntax were quite popular. These include: A Beginner’s Guide to the True Order of SQL Operations A Probably Incomplete, Comprehensive...
View ArticleNever Concatenate Strings With jOOQ
jOOQ supports a vast amount of SQL syntax out of the box. As such, most users will not think of resorting to string concatenation like in the old days when writing dynamic SQL with JDBC. But every now...
View ArticleUsing Java 13+ Text Blocks for Plain SQL with jOOQ
Most jOOQ users use the jOOQ DSL API, which provides compile time type safety and an easy way to write dynamic SQL. But occasionally, this DSL get in the way, because it might be Overkill for some very...
View ArticleCreate Empty Optional SQL Clauses with jOOQ
When using jOOQ to create dynamic SQL statements (one of jOOQ’s core value propositions), it is often necessary to add query elements conditionally, with a default “No-op” behaviour. For first time...
View ArticleWhat’s a “String” in the jOOQ API?
One of jOOQ’s biggest strength is the fact that it is a type safe SQL API. “Type safe”, in this context, means that every object that you put in a jOOQ query has a well defined type, such as: Condition...
View ArticleThe Many Flavours of the Arcane SQL MERGE Statement
The SQL MERGE statement is a device whose mystery is only exceeded by its power. A simple example shows its full power according to standard SQL. Imagine you have a production table for product prices,...
View Article