Tag Archives: mysql

MySQL Group Concatenation – The hidden function

mysql group concat

The MySQL GROUP_CONCAT function isn't a well-known feature, but it is one of the most useful functions that exists in MySQL. I call it the "loop-killer". Here are a few ways to put it to use on your site. more …

Fun with SQL Injection

sql injection

There are dozens of different ways to be a victim of an SQL injection attack. This article offers a more example-driven approach to learning about SQL Injection and how to avoid it. more …

Hand some validation over to your database

database validation

Performing validation at the database level not only protects the integrity of our data, but also presents a performance enhancement while simplifying our application code. more …

The right kind of database backup

Depending on the arrangement with your data center or hosting provider, they may offer you some form of "off-server" backup. In some cases, you identify a folder for them to backup (which you will copy all of your mission critical … more …

Avoid the MySQL password function

MySQL offers a convenient method to store user passwords, encrypted in a database table. You use the password function both to store a password, and check a plain text string for password matching to authenticate a user. However, if at … more …

CONCAT returning empty value

This is a strange one, and I don't have anything to back it up, just one occurrence. I attempted a CONCAT of a few fields, some of them being NULL values. If a row contained a field with a NULL … more …

MySQL emptying a table

Just a quick MySQL optimization note. Many times we're required to clear a database table and reset the auto increment counter. This is common with import scripts (importing data from Excel, etc). The uncool way to do it: DELETE FROM … more …

MySQL Duplicate Key issues

So you're doing a bulk import into your MySQL database, knowing that your primary key values are unique. Yet, MySQL throws the Duplicate Key message your way. If your primary key is character based, and you are like most, you … more …