Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Newbie! Access to SQL

Status
Not open for further replies.

Barneye

MIS
Mar 5, 2002
68
US
How do I setup relations in a SQL database? I am new to SQL but I have used Access alot and have gotten good at it.
 
If you are referring to Foreign Key relationships, the easiest way is to use the enterprice manager.

Drill down to the database, and then click on diagrams. Add a new diagram, select your tables, create the links, and you're done.

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
Check out the BOL. If we understand you correctly, you need to create a primary key in one table and make a foreign key in the second table that matches the PK.

Table 1
LName
FName
EmpID PK

Table 2
DeptID PK
EmpID FK

Then you would JOIN the tables by the EmpID. However, they don't need to have the same names, just the same value:

Table 1
LName
FName
Phone PK

Table 2
CompanyName PK
ContactNumber FK

-SQLBill
BOL=Books OnLine=Microsoft SQL Server's HELP
Installed as part of the Client Tools
Found at Start>Programs>Microsoft SQL Server>Books OnLine
or online at:


Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top