MySQL's not equal operator doesn't match null values
Today I learnt that MySQL's 'not equal' operator (
<>) does not match null values unless you are specifically doing a comparison on a null value.
Calculating the Difference Between Two Dates in MySQL
To calculate the difference between two dates, MySQL offers us two different methods:
TIMEDIFF. Which you use depends how you want the resulting difference formatted.
Resolving post-install Issue with MariaDB Install via Homebrew
I have been attempting to install MariaDB on a new MacBook with Catalina installed using Homebrew. However, I hit an issue with the post-install step failing which meant the installation didn’t work. I’m sharing how I managed to successfully install MariaDB here for anyone else that hits a similar problem.
Why I'm Loving TablePlus
For the last few months I’ve been using a great app for working with databases called TablePlus. I want to share with you some of the reasons why I like it. Just to be clear, this is a personal piece; I have not been paid to write this and have no affiliation with TablePlus or its developers. I simply love using it and here’s why.
What the �Ã¡¥! Exporting UTF-8 Data From a latin1 MySQL Table
Have you ever found yourself stuck with gibberish characters in a database that you’ve just imported? Is your data looking like someone’s tried to mask expletives? Then perhaps you’ve found yourself exporting a latin1 encoded database containing UTF-8 characters.
Populating a MySQL Column with Incremental Values
Last week I found myself needing to quickly seed a column in a database with incremental datetime values. This is not something I’d ever needed to do before in MySQL, but the solution I found was beautifully simple. So I am going to share here how I did this and show you how you can easily populate a column for existing records with an incremental value.
Ordering by a Specific Field Value in MySQL
If you need to order results from a MySQL query by a specific field value first then there’s a couple of approaches you can use. Let’s use as an example a table of countries where we want to order alphabetically but put the United Kingdom first.
Saving Emoticons/Unicode from Twitter to a MySQL Database
The last couple of days I’ve been developing a little app that imports Twitter feeds and saves tweets to a MySQL database; however, I quickly hit an issue where certain tweets would not save. MySQL was returning the error message ‘SQLSTATE[HY000]: General error: 1366 Incorrect string value’. Looking at the specific tweets causing the database to throw the error I noticed that they contained emoticons.