Book Image

Creating your MySQL Database: Practical Design Tips and Techniques

By : Marc Delisle
Book Image

Creating your MySQL Database: Practical Design Tips and Techniques

By: Marc Delisle

Overview of this book

For most of us, setting up the database for an application is often an afterthought. While you don't need to be a professional database designer to create a working application, knowing a few insider tips and techniques can make both the process easier and the end result much more effective. This book doesn't set out to make you an expert in data analysis, but it does provide a quick and easy way to raise your game in this essential part of getting your application right.
Table of Contents (12 chapters)

In-Column Data Encoding


The situation I am about to describe happened while I was working on a search engine for bibliographic data but I am transposing it for the car dealer's system.

When we have to migrate data from a pre-existing system into our newly-born data structure, we might encounter data that was formatted in a special way. For example, a list of possible colors for a car model could be expressed as a series of color codes, separated by semi-colons:

1A6;1A7;2B7;2T1A65

Users of the pre-existing system are comfortable with this method of entering data in this format, and in the case I experienced, users refused to let go of this way of entering data—and they had direct access to the MySQL tables. From a developer's perspective, however, such format makes the task of query generation more complex. Finding the 1A6 color involves splitting the data element, and avoiding the 2T1A65 data element, which also has the 1A6 string.

A proper structure for this case implies getting rid of the...