Thursday, January 16, 2014

Table Theory

Tables are the backbone of every database.  This is because data is stored in tables. Tables are made of records, which are made of fields. Each record will have the same 'footprint' meaning that it will have placeholders for each bucket of data rt each 'field'.

Imagine a paper phone book. Each page will have dozens of records usually a name, a phone number and an address, at the very least. Each record has the same 'shape' or 'layout', but the information is different:

Name Address Phone
---------- ----------------- ----------
Joe Shmoe 10 Apple Lane 555-1212
Jack Smith 22 Blue St 555-3456
Sam Sneer 35 Hidden Trail 555-9898

In this case you might have a table named TelephoneNumbers. There would be three fields, a Name field, an Address field and a Phone field.

      As you look at this information, each column of a specific type of data, vertically, would be referred to as a 'field', like the Name field or the address field. Each set of data going across would be an individual record.

In databases it is a good idea to give each table a unique field. This unique field is an id that is really useful to the database but primarily useless to a human being. It helps the database keep track of records just in case two records were identical in every way. This should never happen in real life in a phone book, unless everybody's name is 'Earl', but it can definitely happen in a database.



With a unique identifier the table would be structured something like this:

ID       Name Address Phone
---      ---------- ----------------- ----------
1        Joe Shmoe 10 Apple Lane 555-1212
2        Jack Smith 22 Blue St 555-3456
3        Sam Sneer 35 Hidden Trail 555-9898

By using this new 'key' field the database will not only be able to track specific records but it will also be able to 'relate' the data in this table to records in other tables.

SQL SERVER COURSE - 95% OFF FOR OUR READERS

For those of you that would like to broaden your understanding of SQL Server, or if you work with someone who needs a little (or a lot of) help :), We are offering a huge discount to one of our most popular online courses. It is the lead off course which discusses tables - what to do and not do. It is very instructional, practical and straightforward.

Normally this course is $199.00, but for a limited time it is available through this offer for only $3.00!   Click the link below to get started:



No comments:

Post a Comment