Database Naming Conventions 
PHP Tutorial Index

This article hopes to address an issue that occurs in online help forums. Usually users that are requesting help don't know much about what they are doing, so they don't know exactly the jargon to explain what they want to do. This creates a communication breakdown that can be frustrating for many parties involved, and wastes time of voluntary helpers.

One of the most common problems people have explaining is handling data from databases. There's a lot of different ways to try to explain what you want to do with data, but not often is it clear what the actual aim is.

Let's try to simplify how we can describe data from a database:

When using a database, you generally start by connecting to the server, then selecting a database to use, then a table, then you can send a query to find some records and finally those records contain fields which hold the data that you want. So we have:

+-1. Server--------------+
| +-2. Database---------+|
| | +3. Table----------+||
| | | +-4. Record-----+|||
| | | | +-5. Fields--+||||
| | | | | +-6. Data-+|||||
| | | | | | Values ||||||
| | | | | +---------+|||||
| | | | +------------+||||
| | | +---------------+|||
| | +------------------+||
| +---------------------+|

Notice how each element sits within another in the structure? If you can understand this structured design of the data, you can better understand how to explain what you want to do. Now lets take a closer look at a "Record":

A record could be described as a single representation of some group of data that means something in the real world, or to some person. For example, in a table that holds data about people that work in an office the records may have fields like: First name, Last name, Date of Birth, Home Address, Next of Kin, Emergency Contact Number etc.

Field Names: |firstName |lastName |dateOfBirth |addressHome |etc. |
Record 1 -> |Joe |Bloggs |01/01/1970 |1 Road St |etc. |
Record 2 -> |Jane |Globbs |31/12/1990 |99 Street Rd |etc. |

All those piece of data (fields) make up a single representation of a person working in that office, in the context of their personal information. So a record is made up of an undefined number of fields. (It could be 2, it could be 200 or anywhere between and beyond)

The communication problem begins when people don't realize that you should call each element of the data by a correct name. This doesn't mean we need to use only the name "Record" for a collection of fields. Consider, a record in a database table can easily be called a "row" and it is still understandable which piece of data you are talking about. Fields can be called "columns" and so on.

PHP Tutorial Index