Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gregevans
Starting Member
1 Post |
Posted - 2011-11-19 : 16:33:59
|
| Hello, I have searched far wide on two topics, with no luck. The two topics area) Relationshipsb) Joins (Inner joins and cross joins etc)I understand that creating a join, creates a link betweentwo tables, based on a condition. (I suspect this creates a recordsetof both tables, that a query works against) Q. I suspect a Join, doesnt change the structure of a database, whereas a relationship would? (what does this mean?)Q. If you have a join, do you still need relationships?Q. If you have a relationship, do you still need joins?Q. Instead of a join, can you just create a WHERE clause againstone of the tables, defined in a relationship. Because the relationshipties two tables together, does a query work accross both tables, definedin a relationship. For example, if a relationship ties two tables together, does an INSERTSQL action, on the first table, update the second table automatically.Would you use a join to do this or a relationship action. Greg |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-11-19 : 17:26:07
|
| Relationships and joins, while related, are two different topics.Q. I suspect a Join, doesnt change the structure of a database, whereas a relationship would? (what does this mean?)A. A relationship is an object (a foreign key) that is stored in the database. A join is simply part of a query. DML queries don't change the structure of a database.Q. If you have a join, do you still need relationships?A. AbsolutelyQ. If you have a relationship, do you still need joins?A. Absolutely. A relationship can't bring back records from multiple tables for you. Only a Join can.Q. Instead of a join, can you just create a WHERE clause againstone of the tables, defined in a relationship. Because the relationshipties two tables together, does a query work accross both tables, defined in a relationship.A. Nope. Need to explicitly join the tables if you wish to retrieve records from both. |
 |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
|
|
johntech
Yak Posting Veteran
51 Posts |
Posted - 2011-11-21 : 05:19:12
|
| when there are a relationship between 2 tables so you can use an inner or outer join as a result of that ,So there are integration not Contradiction among them ,For example if you insert into one table join another table no utomatic update happened but if constraints so i can't delete from one depending on another ,So at insert i should insert at 2 tables at same time |
 |
|
|
|
|
|
|
|