26.05.2015 Views

o_19m7st4t316nvv6a1bg63l10e4a.pdf

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Yet, despite how common databases are, they aren't very well understood.<br />

Every day, new webmasters become database administrators without even<br />

understanding the first thing about databases. When you use a database on<br />

the web today, you're not just using any database: you're using ones that<br />

rely on concepts built up over decades of database development and proven<br />

effective. Here are some of those concepts.<br />

Relational Databases.<br />

The most common database model in use today is that of the relational<br />

database – others include hierarchical databases (where data is organised in<br />

'trees', like an organization's management structure), and flat file databases<br />

(where data is stored in 'records' in a text document).<br />

In a relational database, data is stored in tables. The columns are called<br />

fields and the rows are called records. So, for example, a table might have<br />

two fields: firstname and lastname. If you then added a record to this table,<br />

it could be 'Bob' and 'Smith'. Instead of just having that data, you have<br />

labeled it with what it is, and that lets you refer to it and search through it<br />

much more easily.<br />

Where the 'relational' part is really significant, though, is when it comes to<br />

the way tables in a database relate to the other tables. Each record of each<br />

table has an ID number (technically known as the 'primary key') – for<br />

example, the Bob Smith record might be ID number 123. This then lets you<br />

refer to his record in a new table.<br />

Let's say you were storing records of people's orders. You could have two<br />

columns: customer number and date. This lets you simply store 123 and the<br />

date in the table each time Bob Smith orders from you – the relational<br />

nature of the database will tell you later on that customer number 123 is<br />

Bob Smith. When it comes to things like, for example, storing posts made by<br />

multiple authors, this is powerful.<br />

SQL Databases.<br />

SQL stands for 'Structured Query Language'. It's the most popular language<br />

for making queries to relational database systems. What's a query? It's<br />

basically a way of asking the database to find a record for you that matches<br />

The Web Design Guide for Newbies |64

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!