Finding all Palindromes Contained in Strings with SQL

SQL is a really cool language. I can write really complex business logic with this logic programming language. I was again thrilled about SQL recently, at a customer site: https://twitter.com/lukaseder/status/899626552597590016 But whenever I tweet something like the above, the inevitable happened. I was nerd sniped. Oleg Šelajev from ZeroTurnaround challenged me to prove that SQL … Continue reading Finding all Palindromes Contained in Strings with SQL

jOOQ 3.10 Supports Exciting MySQL 8.0 Features

In recent months, there had been some really exciting news from the MySQL team: (Recursive) Common Table Expressions in MySQL Introducing Window Functions These two SQL standard language features are among the most powerful SQL features that are available from most other databases. I frequently include them in conference talks about SQL (see my article … Continue reading jOOQ 3.10 Supports Exciting MySQL 8.0 Features

10 SQL Tricks That You Didn’t Think Were Possible

Listicles like these do work - not only do they attract attention, if the content is also valuable (and in this case it is, trust me), the article format can be extremely entertaining. This article will bring you 10 SQL tricks that many of you might not have thought were possible. The article is a … Continue reading 10 SQL Tricks That You Didn’t Think Were Possible

Time for some Funky SQL: Prefix Sum Calculation

This Stack Overflow question has yet again nerd-sniped me [finding the] maximum element in the array that would result from performing all M operations Here's the question by John that was looking for a Java solution: With an array of N elements which are initialized to 0. we are given a sequence of M operations … Continue reading Time for some Funky SQL: Prefix Sum Calculation

How to Find the Closest Subset Sum with SQL

I've stumbled upon this very interesting question on Stack Overflow, recently. Its title is: [How to] compare a number with sum of subset of numbers In this article, we'll compare the user's imperative approach to the extremely elegant (Oracle) SQL approach. We'll be making use of any combination of these awesome SQL features: Window functions … Continue reading How to Find the Closest Subset Sum with SQL

What Exactly are SQL Views?

You probably know about "ordinary views" already, but I'm sure you'll find one or two things in this article that you haven't thought about in this way yet... What exactly are SQL views? Views in SQL are a means of treating complex queries in the same way as "ordinary" tables. In fact, SQL is all … Continue reading What Exactly are SQL Views?

All You Ever Need to Know About Recursive SQL

Oracle SYNONYMs are a great feature. You can implement all sorts of backwards-compatibility tweaks simply by creating SYNONYMs in your database. Consider the following schema: CREATE TABLE my_table (col NUMBER(7)); CREATE SYNONYM my_table_old FOR my_table; CREATE SYNONYM my_table_bak FOR my_table_old; Now you can query your same old table through three different names, it'll all result … Continue reading All You Ever Need to Know About Recursive SQL

Yet Another 10 Common Mistakes Java Developers Make When Writing SQL (You Won’t BELIEVE the Last One)

(Sorry for that click-bait heading. Couldn't resist ;-) ) We're on a mission. To teach you SQL. But mostly, we want to teach you how to appreciate SQL. You'll love it! Getting SQL right or wrong shouldn't be about that You're-Doing-It-Wrong™ attitude that can be encountered often when evangelists promote their object of evangelism. Getting … Continue reading Yet Another 10 Common Mistakes Java Developers Make When Writing SQL (You Won’t BELIEVE the Last One)

The 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 language out there. It has so many caveats that people like me get ridiculously rich selling consulting services … Continue reading The SQL Language’s Most Missing Feature

MySQL 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 question. It reads: "Why Oracle does not support 'group by 1,2,3'?". At first, I thought this user might have been confused because … Continue reading MySQL Bad Idea #666