Saturday, October 31, 2015

Day 6

ERDs


I remember when I worked at ADP, I would use Access a lot to pull information from our databases. Today I learned how to set up those databases and pulling information is a lot easier than creating them... ERD are known as entity relationship diagrams. I learned about the 3 relationships: 
  1. One-to-one 
  2. One-to-many 
  3. Many-to-many
When first going through the videos, it makes a lot of sense; have unique IDs for every table, foreign keys in the tables you want information on, and many to many relationships have to have a joining table. Then the normalization rules:
  1. Each column have can only have 1 value (think address street, city, state, zipcode being broken up into separate columns)
  2. If not foreign or primary key, cannot repeat values. This prevents repetition of data.
  3. Non-key columns cannot be dependent on non-key columns. Meaning, that if you have a column in a table that affects other columns, (like zip codes determining state and city), then you must create another table for that column and have a foreign ID put into the original table.
Here's a picture to illustrate:


















Then, after learning just these 6 things, they start asking questions on the assignments that slowly didn't make sense. I don't know why it took me so long to understand these concepts. The only cure was to keep practicing and answering a variety of questions. But the one question that will stick to my mind is: can A have multiple B? Can B have multiple A? To determine what relationships the two objects have with each other.

The assignments weren't too difficult and didn't take a long time although the instructions could be clearer. All in all, the more assignments I finished, the more I understood the subject although now my issue is that I can't fully explain my decision about creating relationships between tables. I can't believe that most DBs can have 50+ different tables when I'm struggling with just 5!

No comments:

Post a Comment