How to use the LEAD() Window Function and discover gaps in Dates

Many of you may know that I am an avid walker. I enjoy walking and hiking for the health and mental benefits. I’m also finicky about the footwear I wear on my walks. I recently used the LEAD() Window function on some of the walking data I track and discovered gaps in the ranges of dates that I wore a particular brand of shoe. Continue reading and see the example queries I came up with to solidify learning concepts about LEAD()

(more…)

Two SQL Queries to find rows present in one table but not another.

Sometimes when querying SQL tables, you wish to find rows that are missing as opposed to the rows which are present. In this post, I’ll demonstrate 2 queries you can use to determine rows that are present in one table but missing in another table…

(more…)

RECURSIVE CTE Fun with SUBSTRING() in MySQL

Although I primarily work with MySQL/MariaDB these days on back-end web development projects, I am studying Oracle SQL with the end goal to become certified. I recently watched a great YouTube video and decided to try my hand porting over the Oracle SQL queries to comparable MySQL for a learning exercise. This blog post details the queries I came up with for the end results. Continue reading for some fun recursive CTE’s using the SUBSTRING() character function and interesting output display variations.

(more…)

How to use the NVL and NVL2 functions in Oracle SQL

As an SQL professional or developer, at some point, you’re going to encounter the infamous NULL value (or marker as some say). NULL‘s can be super tricky to get right until you halfway understand them. Fortunately, all the popular SQL vendors have various functions in place that help work with NULLs. In this post, I cover 2 such functions found in the Oracle database, NVL() and NVL2().

(more…)

MySQL BETWEEN Operator Queries – Are they inclusive?

I recently learned of some odd behavior using MySQL BETWEEN operator queries, filtering by a DATETIME column. I wrote about this over on Medium so I am sharing the post for any readers here who are interested…

(more…)