Meaning of JOINs in sql

hibernatejoin;

I was trying to interpret the relationship between JOINs like LEFT-OUTER JOIN, RIGHT-OUTER JOIN, etc with relationships like Many-To-Many, One-To-Many etc in Hibernate or database language.

Best Answer

Relationships are used for describing how the tables are well, related and for enforcing this such as satisfying a foreign key from one table requires a matching entry in another. A join is used to realize those relationships. In a join you are telling the database what fields to match and how when it is executed. In a relationship you are telling the database to enforce this for future queries. Also joins are used in gathering data, whereas relationships are meant to maintain data integrity from update anomalies as well as used for conceptual reasons for developers and DBAs to know how the tables are meant to be used.