Tag Archives: database
Taking on a Database Change Process
SQL JOINing a Table to Itself
Consider that tried-and-tested example: employees and managers. Here’s the staff
table from the database (today’s imaginary data isn’t particularly imaginative, sorry):
mysql> select * from staff; +----+------------+-----------+------------+ | id | first_name | last_name | manager_id | +----+------------+-----------+------------+ | 1 | Hattie | Hopkins | 4 | | 2 | Henry | Hopkins | 4 | | 3 | Harry | Hopkins | 5 | | 4 | Helen | Hopkins | NULL | | 5 | Heidi | Hopkins | 4 | | 6 | Hazel | Hopkins | 1 | +----+------------+-----------+------------+ 6 rows in set (0.00 sec)
Inner vs Outer Joins on a Many-To-Many Relationship
Continue reading
Importing and Exporting MongoDB Databases
mysqldump
for mongodb?
It should have come as no surprise that the command I wanted was called mongodump
, really! Continue reading
Explaining MySQL’s EXPLAIN
Handling SQL Errors in PDO
Simple CRUD with MongoDB
Continue reading
Script for Database Patching at Deploy Time
My current project (BiteStats, a simple report of your google analytics data) uses a basic system where there are numbered patches, and a patch_history
table with a row for every patch that was run, showing the version number and a timestamp. When I deploy the code to production, I have a script that runs automatically to apply the patches.
Is Enum Evil?
There are cases where an enum is the correct choice for a particular type of data, so let’s look at what an enum type actually is and does.