Filter By Category - Mysql


Here's some of my tips, tweaks and tuts, ranging from PHP, Linux, MySQL and more!

Snippets / MySQL

Exclude "The", "An" & "A" from MYSQL Ordered list

The aim was to display results from my database in alphabetical order and not having words such "an" or "the" to impact on the alphabetical order (similar to iTunes album order). So for example The Doors would be displayed in the "D" artists A Solution (Slow one) One way of doing this I thought we could trim the appending name...

6th Dec, 2011 | » Read more Snippets like this | » Read More

Snippets / MySQL

Delete Duplicate Rows in MySQL

Over time tables can contain duplicate entries, one of the main reasons is the system inserting the data is either not preparing it correctly, or not checking against existing records. The Statement Before you run the query make sure you backup the table as it will remove data, an extra check you could always do a SELECT query inste...

11th Oct, 2011 | » Read more Snippets like this | » Read More

Snippets / MySQL

Backup all MySQL databases into seperate files with crontab

It's highly recommended to keep a backup of all your data and with the following script you can setup an automated task to create a weekly backup of your data without having to manually run it; with linux! The Shell Script "db-backup.sh" Next Step Add to Crontab In order for the script that we have created to be executed automa...

24th Sep, 2011 | » Read more Snippets like this | » Read More

Snippets / MySQL

Filter results by todays date - MySQL

MySQL is a very powerful open source database and there was no suprise when I found there was a way to retrieve records from a database that expired at @ 11.59 of the "end_date" field. You can alternatively do this via php date() function as well.The SolutionAll I wanted to happen was a simple way to display meetings that weren't expired,...

12th Jul, 2011 | » Read more Snippets like this | » Read More