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…)

How to re-order a comma-separated list in Oracle SQL

Suppose you have a comma-separated list composed of numbers and you want it sorted in order from smallest to largest. Continue reading and see a working example I came up with as I continue studying Oracle SQL…

(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 ORDER BY is restricted in GROUP BY queries

As always, I am sharing what I learn here on my blog. As I continue to study SQL, the language never ceases to amaze me with those little intricacies you don’t necessarily learn of unless you are bitten by them, or through intentional study. Luckily, my case is the latter of the 2. I’m referring to the ORDER BY clause when used in GROUP BY queries. Continue reading for more information.

(more…)