News Feed
Jobs Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

CodeForest.net:
Key/value tables and how to use them in PHP and MySQL
September 10, 2010 @ 12:36:52

On the CodeForest site there's a recent tutorial that offers a different option for those dealing with an application that has the possibility for rapid change in its database structure - a key/value table in a standard relational database (no, not NoSQL).

Key/value approach in database design could come in handy when we need to store some arbitrary data about another table. For example, we have a users table that holds our user data. Everything is working fine, but some day our client decides that he wants to collect 2 telephone numbers, sex of the user, date of birth... If we try to predefine all the potential wishes of the customer in our table, it would be awkward and our table would grow horizontally beyond reason.

He compares the traditional "users" table with each column a defined type of data against a key/value table where each record holds both the value and a key relating to its contents. While this technique can be flexible, it can also be abused if it gets out of control. Bill Karwin warns in the comments about it and links to two resources on its use.

0 comments voice your opinion now!
key value table mysql database tutorial


blog comments powered by Disqus

Similar Posts

IBM developerWorks: Locking down your PHP applications

Gonzalo Ayuso: Handling several DBALs in Symfony2 through the Dependency Injection with PHP

Script-Tutorials.com: Autocomplete with PHP, jQuery, MySQL and XML

Gonzalo Ayuso's Blog: Using CouchDb as filesystem with PHP

Brian Moon's Blog: Using ini files for PHP application settings


Community Events











Don't see your event here?
Let us know!


unittest threedevsandamaybe hack series framework introduction podcast opinion application hhvm install symfony2 facebook component package security release composer code language

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework