I usually see in database articles or lessons or... just everywhere where they will use databases, they will use a factor known as relations. It involves my thoughts immediately individuals little boxes with lists of area names and something area attached to another area in another box having a line.

I am no expert on databases (as possible most likely tell) however the tiny bit I have used, I never needed relations. They always appeared to become redundant when i can invariably use JOIN to accomplished what it really appeared in my experience they're designed for. Could they be redundant or perhaps is there anything that you can do with relations that you simply canrrrt do with JOIN? Or shall we be held just speaking nonsense?

Relations aren't nearly joins for SQL queries. Relations provide benefits:

  • Data integrity
  • Query convenience
  • 3rd party tool integration benefits
  • "Self-explaining" data model to future dbas/designers dealing with the database
  • Etc

Data integrity: Relations make certain that the "order records" can't exist with no "customer record" for instance. By simply determining rapport between customer and order, the database will make sure this cannot happen. This can help to make certain that the database does not be a large pile of junk data

Query convenience: Relations makes it simpler to complete certain kinds of queries. Removing a person record can instantly possess the customer's orders erased simultaneously, because of the connection between customer and order

3rd party tool integration benefits Many 3rd party tools (O/R tools spring to mind) depend on relations to be able to work correctly

Really, their email list may go so on...you need to use them, they are very advantageous. Even when you do not see the worthiness today, if you are focusing on a database project which will keep growing on the lengthy time period, it might be in your favor to create associations up right from the start.

I believe that they are not too crucial for small projects/one-off data models...however for anything of substance, you are best with them.

A RELATION is really a subset from the cartesian product of some domain names (http://mathworld.wolfram.com/Relation.html). In everyday terms a relation (or even more particularly a relation variable) may be the data structure that many people describe as a table (although tables in SQL don't always become qualified as relations).

Relations would be the foundation of the relational database model.

Associations are different things. Rapport is really a semantic "association among things".

I believe you're really asking about referential integrity constraints (foreign secrets). An overseas secret is an information integrity rule that guarantees the database is consistent by stopping sporadic data from being put into it. Don't confuse foreign secrets with relations since they're completely different things.

The idea behind databases is dependant on something known as Relational Algebra. Relation isn't a database specific term, it comes from Relational Algebra.

JOIN is type of Relation, there might be different type of relations. Make reference to this wiki page to learn more by what a Relation exactly is.

I am presuming when you're reading through about relations it's most likely mentioning to foreign secrets. If that is true, relations and joins aren't different solutions for the similar problem. They're 2 tools that accomplish various things, and they're usually used together.

A join because it seem as if you know is a component of the choose query that allow you to get rows from more then 1 table.

A relation is area of the database structure its self that defines a guide. For instance should you have had a town table along with a country table, you ought to have a relation pointing each row within the city table to some row in the united states table. This could make sure the integrity from the data and never allow a town row to suggest to some country row that does not exist.

Asking "Why would you use relations when you are able use joins?" in my experience seems like asking 'Why do variables have types after i could read them anyway?".