Tag Archives: MySQL

SQL Order By Cheat Sheet

This is a cheat sheet that I have put together for keeping track of the results of ordering different types of columns in ASC and DESC order and the rules around each.  This order is fairly standard for most ANSI database servers.  However I do not believe that there is anything in the ANSI spec that dictates this as a requirement.

Continue reading SQL Order By Cheat Sheet


INSERT IGNORE is used in our organization to insert new records and ignore records that have the same primary key.  This ignores the duplicate key exception that is generated and simply throws away the record.  This allows for inserting those records to not make without having to employ a LEFT JOIN to avoid the duplication. Continue reading MySQL INSERT IGNORE

Using JOIN for Suppression

We usually use JOIN to find the intersection between two different tables.  For example, if you want all the orders from the order table who belong to a certain set of customers from the customer table.

This is the most common usage of a JOIN, specifically an INNER JOIN.  The results only include the entries that matchup from each table.  There are many other situations that you can incorporate a JOIN to solve.  Particularly here we are going to talk about using a JOIN to suppress information from one table by using another. Continue reading Using JOIN for Suppression