Databases


Recursive Queries With SQL…WHAT!?!

In our application, AgriLife People (ALP), one thing we needed was to be able to build a hierarchical chain of a unit and all its child units.  This is primarily used for cascading down management rights and for building contact lists.  In previous iterations of the application, we cheated by […]


MySQL Replace

Another quick post on a little MySQL function I learned about recently.  As with many such things, its one of those things I discovered only when I needed it (it’s not like I go reading the MySQL manual for fun or anything LOL). So the issue in this case was […]


MySQL Tricks: Splitting Strings

I needed to run a query to find out how many people in our user table had an email address on a domain within a set list from another table.  Normally, I might have written a PHP script for this, pulling users that matched a loose LIKE statement of email_address […]


Basic Refresher on Signed vs Unsigned Integers

You may have heard recently that Psy's "Gangum Style" video "broke" YouTube due to the database using an signed integer that was 32 bits, never expecting a single video to ger more than 2.147 trillon views.  So they upped it to a 64 bit integer.  interestingly enough, they still left […]


Discovering MySQL GROUP_CONCAT

A relatively quick post this week, but I discovered something new in MySQL (as in new to me). A common query one might need to run is to get a list of rows from one table and it's related rows in a connected table.  For example, given these tables: Let's say I […]


MySQL Trigger Flakiness And NULL in Comparisons

On one of our application's databases, we have some triggers in place for row updates and deletes. These triggers fire off stored procedures that take care of making data snapshots for auditing purposes before changes are made. This week, we discovered that those triggers were not always firing, resulting in some gaps […]


32-Bit ODBC "Fun" in 64-Bit Windows

So here's a fun little gotcha that I ran into today.  One of my legacy apps, one of the first ones I built when I came to work at my current job, has graduated away from being in-house app to running on a third-party hosted e-commerce platform.  As part of […]


Quick Changing the MySQL Engine on Existing Tables

On install, MySQL has its default storage engine set to MyISAM. It's heavily used, but IMHO, a bad engine to use for most applications. MySQL does offer a variety of other engines, including Memory, Merge, Archive, Federated, and of course InnoDB. They each have their uses and their pros and […]