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 |
|
sruvee
Starting Member
2 Posts |
Posted - 2007-10-12 : 14:31:00
|
| Hi,I understand that An inner join's ON condition retrieves only those records that satisfy the join condition. An outer join does the same thing but with the addition of returning records for one table in which there were no matching records in the other table. Suppose I write the following Query,SELECT Customers.CustomerID, Customers.CompanyName, Orders.OrderIDFROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerIDORDER BY Customers.CustomerIDDo I need to declare the CustomerID as a Primary Key?Is there any relation between Joins and Primary key declarations?Thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-12 : 14:35:24
|
| Joins do not require that the columns in the ON condition have constraints on them (PK or FK). You are almost always joining on columns that are involved in a relationship though.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
sruvee
Starting Member
2 Posts |
Posted - 2007-10-12 : 15:00:12
|
| How can I create database diagrams depending on Joins? I mean, is it possible to create database diagrams (to show relations between tables) for tables which don't have any Primary keys or FK relation ships? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-10-12 : 15:01:02
|
| I don't know of a tool that can do that. I only know how to create ERDs when PKs and FKs exist.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
|
|
|