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 |
|
Zuhaib
Starting Member
1 Post |
Posted - 2008-06-21 : 07:25:45
|
| I want to learn how to create relations among tables in database in sql server 2000. Suppose I have 5 tables, then How to relate them using SQL 2000. ThanxBukhari |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-06-21 : 11:03:34
|
| Relationships between tables are done by means of primary key & foreign key. Suppose we have to specify relationship between Students table and Subject table. Let sudentid be primary key of student table and Subjectid be PK of Subject table. Then we make a new table StudentSubjects to represent the relationships. We add two fields Studentid and subjectid and make them the composite primary key of this table. Each record in this table represent a relationship b/w Students & Subject table. we ensure Studentid and Subjectid have only those values that are present in respective tables by defining foreign key relationship between each of columns to respective columns in Student & Subject table.You can design these relationships by drawing a database diagrams involving all the tables.Refer link for more infohttp://msdn.microsoft.com/en-us/library/aa176955(SQL.80).aspx |
 |
|
|
|
|
|