This article hopes to be that reference, both for you and myself. Let’s start with some definitions!
Strict equality (
== in other languages) is familiar for most programmers. It checks whether or not two values are identical and of the same type.
During a recent coding challenge, I ran into a SQL query which contained an unfamiliar keyword: DECODE. Perhaps like some of you, I’d never encountered DECODE before. I decided to take some notes, Googling to my heart’s content. Medium didn’t have much of anything on the topic, so I wanted to turn my findings into an article to share with you all.
First, we’ll talk about DECODE, an Oracle-specific SQL function. After learning how DECODE works, we will take a brief look at analogous operators in other database systems (PostgreSQL and MongoDB).
To begin, let’s define the DECODE function in…