What is a relational database?
MySQL is the most widely used database system online. One of the things that makes it so useful is that it is a relational database. It can store large amounts of information, but can still be searched quickly to return results to the user in real time. But what exactly does it mean to be a relational database? Lets take a look at some non-computer examples to help you visualize what this type of database means.
Let's say you wanted to start keeping information about people who live in your town.
You take an index card and on each one you assign an ID number to a person (this will become important later), write their name, their date of birth, and where they live. The ID number should be a unique number. Although people can share a name, a birthdate or a home, the ID number (such as your social security number) will always be unique to the individual.
You can look through these index cards and sort them by the numbers you assigned, by the persons last name, put them in order by the birthdays, or sort them geographically based on the addresses. At the moment this is representative of a two dimensional database. All of this information could easily be stored in a simple spreadsheet with each row representing a person and each column representing a type of data (such as names, numbers, or dates of birth.)
Now, instead of a single index card let's pretend that each person has a stack of index cards, joined in the corner by a ring, so that you can flip through each stack with ease. On the top of every card, you would continue to have the ID number you assigned the individual.
Every card in the persons stack would contain this number, however this would be the only common piece of data joining the cards. The second card might list attributes about the person such as their height, weight, and eye color. The third card would have information about the persons job, and the forth card might have information about their favorite and least favorite foods. You could have as many or few of these cards in your bound deck as you need.
Now, imagine you were sorting these cards. You could put any of the cards on the top of the ring, and sort by attributes found on that card. Perhaps this time you want to sort by weight. This has now become a relational database. You might also visualize this as a stack of two dimensional databases. The rows still contain data about the user, and the columns all the information in similar categories. The difference is that now under ever ID number cell is an identical ID number cell with completely different information held in it's rows and columns with the exception of this number.
Now, you want to do a study. You want to compare a persons weight with their favorite foods to see if there is a correlation. First retrieve information from one card (or table.) You pull a persons weight and their ID number. Next, you move to the cards (or table) containing a list of favorite foods, and for each ID number you retrieve the list. So your output list looks like this:
ID Number, Weight, Favorite foods
You preformed this search without ever having to search through the data about addresses and birthdays, or other tables that may have information about favorite colors, pets, family members, etc. If this information was all held in a two dimensional database you could see how it might get quite big, but in a relational database it's easy to keep the information in each area concise.
Let's say you wanted to start keeping information about people who live in your town.
You take an index card and on each one you assign an ID number to a person (this will become important later), write their name, their date of birth, and where they live. The ID number should be a unique number. Although people can share a name, a birthdate or a home, the ID number (such as your social security number) will always be unique to the individual.
You can look through these index cards and sort them by the numbers you assigned, by the persons last name, put them in order by the birthdays, or sort them geographically based on the addresses. At the moment this is representative of a two dimensional database. All of this information could easily be stored in a simple spreadsheet with each row representing a person and each column representing a type of data (such as names, numbers, or dates of birth.)
Now, instead of a single index card let's pretend that each person has a stack of index cards, joined in the corner by a ring, so that you can flip through each stack with ease. On the top of every card, you would continue to have the ID number you assigned the individual.
Every card in the persons stack would contain this number, however this would be the only common piece of data joining the cards. The second card might list attributes about the person such as their height, weight, and eye color. The third card would have information about the persons job, and the forth card might have information about their favorite and least favorite foods. You could have as many or few of these cards in your bound deck as you need.
Now, imagine you were sorting these cards. You could put any of the cards on the top of the ring, and sort by attributes found on that card. Perhaps this time you want to sort by weight. This has now become a relational database. You might also visualize this as a stack of two dimensional databases. The rows still contain data about the user, and the columns all the information in similar categories. The difference is that now under ever ID number cell is an identical ID number cell with completely different information held in it's rows and columns with the exception of this number.
Now, you want to do a study. You want to compare a persons weight with their favorite foods to see if there is a correlation. First retrieve information from one card (or table.) You pull a persons weight and their ID number. Next, you move to the cards (or table) containing a list of favorite foods, and for each ID number you retrieve the list. So your output list looks like this:
ID Number, Weight, Favorite foods
You preformed this search without ever having to search through the data about addresses and birthdays, or other tables that may have information about favorite colors, pets, family members, etc. If this information was all held in a two dimensional database you could see how it might get quite big, but in a relational database it's easy to keep the information in each area concise.
Source...