This video introduces the concept of designing relationships. Now, when we have data that is somehow related, we have a relationship. There are three kinds of relationships: One-to-one One-to-many Many-to-many We are going to discuss each one of these in a separate video. The focus of this video is one to one relationships. Once again we have to go back to the concept of entities and attributes. An entity is something we store data about and an attribute is the data we store about the entity. This is an example of a relationship. That's because the entity and the attributes are connected in that one depends upon the other. We can describe this relationship by saying it is either one-to-one, one-to-many, or many-to-many. Let's go through an example of a user and an email. A specific user has one username. Is this email going to be used by other people? The chances are no. This email is exclusive to this user. This is a great example of a one-to-one relationship. That's because a user has only one email, and an email is used by only one person. To better understand this, let's compare it to a different attribute. Let's say this is a bidding website and users can post junk to sell. So we will say that the user has an attribute of his auctions. Is this a one to one relationship? Well, the item for sale is posted by only one user, but the chances are that the website will allow the user to post multiple items. In this situation, the relationship is not one-to-one. It is actually a one-to-many relationship, which we will discuss in more detail in the next video. So let's disregard the one-to-many relationships until the next video and let's focus on how to design one-to-one relationships. It's actually very easy. Because an attribute of an entity that is one-to-one exclusively describes that entity, all we have to do to design this relationship is store it as a column in a table designed for this entity. We could have a users table that has a column of username. Problem solved. When you hear one-to-one, think "column in a table." There is one other way to store a one to one relationship. Let's say you have to store the user's image in the database. The image is going to be one-to-one relationship, but you could store it in a table called users_image and reference the user that the image belongs to. That way, we have a separation from the image data and the users data and we only need to use the users_image table when we need images. So in conclusion, there are two ways: A column in a table. A table designated for that attribute that refers directly to the entity using a foreign key. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)