If we separate out car size and car rate from the Cars table, we'll be left with two tables that look like this: carID | carName |
1 | Toyota Camry |
sizeID | sizeName | sizeRate |
1 | medium | 1.2 |
Do you see anything missing here? You should. We need a way of joining these tables - a way to link a size and rate to a specific car. We need to add a column (sizeID) that will allow for this join. In fact, we need to go through every one of the tables we created on the previous page and add fields that let us establish these relationships.
Now maybe you understand why they call these things relational databases.
Before we move on, let's take a second to jot down all this table information. (Hopefully, it'll make it a bit easier to keep track of these different tables.)
Just one quick note about this change. I've made an executive decision: The Email field will serve as the Primary Key for the Clients table. Yes, I know it's possible for more than one person to use the same email address. For the sake of this database, however, I'm assuming that each person who comes to my site will have his or her own email address.
I reviewed this data structure some months after first publishing this tutorial and saw that there was some room for improvement. The carID, slopeID, and tranID fields should probably be in the Appointments table, not the Clients table. That way, one client would be free to obtain lessons in any number of cars or slopes. This error won't affect the rest of the tutorial, but it's definitely something to be aware of. (See, good data structures are hard!)
If you're starting to feel a bit disconnected from the data right now, don't worry. Just keep moving forward. It should click for you down the line.
Now that we have our structure, we need to go to our RDBMS (in my case, MS Access) and create the tables.
next page»