How To Set Up Relational Database

I had a suggestion from a reader named “Dennis” after trying
to gather information for a new database book.

He responded:

Erik,
My suggestion is this:
Make an easy tutorial to set up a database with tools on how to setup
tables, link tables, how to set up keys on tables.
Most tutorials tell users how to set up a database for one type of database
(food).
Looking forward to the class
Regards,
Dennis Follis

I felt that this particular concept will vary based on
everyone’s different needs. So the principle probably is more helpful:

1. Always store 1 type of information in 1 table.

2. Make sure the table in step one has a unique index (Primary Key) field column.

-A unique index is a unique assignment to every row in that table.

-This unique value field column is different for every record in your table.
Much like, you cannot have the same social security number as someone else, or
your driver’s license number cannot be the same as someone else.

3. When you create another table, that contains only 1 type of information, but relates to the first table,
it needs only to reference the unique record id, or the other table’s primary key.

In other words, this is known as your “primary key” and “foreign key” relationship.

Examples:

tblFood- FoodID,FoodName

tblKid- KidID, KidName

tblKidAndFood – FoodID, KidID

FoodID is the unique identifier for every row in the tblFood table.
KidID is the unique identifier for every row in the tblKid table.

tblKidAndFood is called a “junction” table, and joins the 2 tables,
tblKid and tblFood together.

Now, I don’t want to overload you with information, so do this with your
own database and let me know if you have more questions.

Erik Loebl


Comments are closed.