Publicly available SQL standard documents
For your reference, here is a list of publicly available SQL standard documents. Some are very late draft versions, where the final version is closed source and has to be purchased from ISO or ANSI...
View ArticleThe IS DISTINCT FROM predicate
The SQL-1999 standard specifies a useful IS DISTINCT FROM predicate, that behaves slightly different from the regular not equal comparison predicate. Here is its simple definition: 8.13 <distinct...
View ArticleRow value expressions and the NULL predicate
Row value expressions are something very powerful in SQL. They have been around since the early days of standard SQL, e.g. in SQL 1992, even if not all databases implement them correctly, still today....
View ArticleRow value expressions and the BETWEEN predicate
Now this is a simple example of how SQL clause simulation can get nasty if you want to make use of some more advanced SQL clauses that aren’t supported in all databases. Consider the following...
View ArticleSimulating the SQL standard derived column list
Derived column lists are a fine feature, if your database supports them. The SQL:2008 standard specifies 7.6 <table reference> <table reference> ::= <table factor> | <joined...
View ArticlejOOQ as a PL/Java language
Some people who get in touch with PL/SQL, PL/pgSQL, T-SQL, or any other proprietary procedural language for SQL interaction are probably missing out on a couple of language integration features in the...
View ArticleOracle 12c Goodies: { CROSS | OUTER } APPLY
I can’t believe my eyes. Has this been openly communicated by Oracle? I haven’t seen too many blog posts on that matter. Apart from introducing the awesome SQL Standard OFFSET .. FETCH clause (just...
View ArticleThe Premature Return to SQL
In online communities, the NoSQL topic (much like the ORM topic) is a guarantee to stir emotions. Many emotions are stirred by evangelists on either side for ideological or marketing reasons. Here’s an...
View ArticleProbably the Coolest SQL Feature: Window Functions
Once you get a hang of the very peculiar syntax, SQL is a highly expressive and rich language offering incredible features at a declarative level. One of the coolest features are window functions,...
View ArticleCounting Distinct Records in SQL
The SQL language and its depths… Some of you readers might be aware of MySQL’s capability of counting distinct records through the COUNT() aggregate function. The MySQL documentation reads:...
View ArticleThe Great SQL Implementation Comparison Page
Fortunately, we have SQL standards. Or do we? It’s a well-known secret (or cynical joke) that the SQL standard is yet another SQL dialect among peers. Standards by xkcd On this blog, we have pointed...
View ArticleMySQL Bad Idea #666
MySQL… We’ve blogged about MySQL before. Many times. We’ve shown bad ideas implemented in MySQL here: MySQL Bad Idea #384 MySQL Bad Idea #573 But this beats everything. Check out this Stack Overflow...
View ArticleWhy Did SQLJ Die?
Every now and then, SQLJ pops up somewhere, mostly in a very dusty/enterprisey or in an academic context. If you give SQLJ some thought, though, it isn’t such a bad idea. It is: An ANSI and ISO...
View ArticleThe SQL Language’s Most Missing Feature
SQL is also awesome in many ways. We can write out the most complex truths and facts and have the database tell us the answer in no time. But the SQL language is arguably the most beautiful programming...
View ArticleLesser-Known SQL Features: DEFAULT VALUES
A lesser-known SQL feature is the DEFAULT keyword, which can be used in INSERT and UPDATE statements. Consider the following table, created using standard SQL syntax: CREATE TABLE timestamps ( id...
View ArticleAn MS Access SQL Transformation Odyssey
Recently, we’ve added support for the MS Access database in jOOQ 3.3. This may well have been our hardest integration so far. The MS Access database has its ways, and many of them, too. But luckily,...
View ArticleHow can I do This? – With SQL of Course!
Haven’t we all been wondering: How can I do this? I have these data in Excel and I want to group / sort / assign / combine … While you could probably pull up a Visual Basic script doing the work or...
View ArticleNoSQL? No, SQL! – How to Calculate Running Totals
If anything at all, our jOOQ talks at various JUGs and conferences have revealed mostly one thing: Java developers don’t know SQL. And it isn’t even necessarily our fault. We’re just not exposed to SQL...
View ArticleShould I Put That Table Alias or Not?
Infrequent SQL developers often get confused about when to put parentheses and/or aliases on derived tables. There has been this recent Reddit discussion about the subject, where user Elmhurstlol was...
View ArticleUse MySQL’s Strict Mode on all new Projects!
MySQL is a database that has been bending the SQL standard in ways that make it hard to move off MySQL. What may appear to be a clever technique for vendor lockin (or maybe just oversight of the...
View Article