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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 basic concept clarification

Author  Topic 

phuang1226
Starting Member

5 Posts

Posted - 2007-10-02 : 13:21:30
The distinction between Entity and Relationship is obvious to me. But I am confused by Table. Table describes Entity, Relationship, or both?

Thanks for any input.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-02 : 13:27:27
Table is an entity, which is also known as an object. Relationships are between tables/views. It is also known as referential integrity.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

phuang1226
Starting Member

5 Posts

Posted - 2007-10-02 : 13:38:56
quote:
Originally posted by tkizer

Table is an entity, which is also known as an object. Relationships are between tables/views. It is also known as referential integrity.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/



Thank you. But I do see example where Tables are also used to describe the relationship between entity classes. How do you think about this?
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-02 : 13:46:15
you must be meaning many to many relationship.
this means you have 3 tables
2 main and a 3rd which is a connecting table which smply holds keys from other 2 tables.


_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-02 : 13:46:38
Perhaps you should show us what you mean.

Is this homework material?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

phuang1226
Starting Member

5 Posts

Posted - 2007-10-02 : 13:56:33
quote:
Originally posted by tkizer

Perhaps you should show us what you mean.

Is this homework material?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/



It is not homework. I am out of school. In my current work, I am using Access and also try to program (VBA) inside. I am reading the book by Steven Roman "Access Database Design and Programming". Inside this book, he used a example throughtout the wholebook, which is a database called "Library". I am not far yet. In his E/R diagram, the Entity classes are BOOKS, AUTHORS, PUBLISHERS, each is implemented by a table. So this gives me the impression that Table is used to impletemnt an Entity class. But since there is no link between BOOKS and AUTHORS, he used another table to establish the link. So this means Table can be used to describe a Writtenby relationship. That is where my confusion comes from.
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-02 : 13:58:47
yes it's probably a many to many, since a book can have multiple authors and an author can write multiple books.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-10-02 : 14:01:33
The link is still an entity. In between the 3 tables are relationships.

But yes that linking table can describe a relationship, however it's not technically a relationship. Relationships are foreign keys.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

phuang1226
Starting Member

5 Posts

Posted - 2007-10-02 : 14:17:27
quote:
Originally posted by spirit1

yes it's probably a many to many, since a book can have multiple authors and an author can write multiple books.


Yes, the Table called Book/Author describes a many-to-many relationship. back to my confusion. I am still assuming that Entity class and Relationship are totally distinct. In other words, an entity class is not a relationship, and a relationship is not a entity class. But in implementation, Table is used to describe both of them. Do you agree?

Thanks for sharing your opinion.
_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-10-02 : 14:26:14
huh? i'm not quite sure how to understand this...

yes relationship and table are different things. but since you can't provide many to many relationship with just one relationship you have to use a 3rd table which links the 2 outer tables

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -