entity set and entity

In ER diagram,

wt is the defination of entity set and entity?

what is the difference bewteen entity set and entity?

what is the difference bewteen relationship set and relationship?

is entity belong to entity set?

and relationship and relationship set is also the same case?

Update:

moverover, wt is the difference between primary key and candidate key?

is primary key only contain 1 attribute?

and, wt is super key? y or when is it needed?

雖然問多了很多, 但希望能解答多少便多少...thanks so much!!!

Update 2:

y there are constraints in primary key (primary key constraint)?

what does primary key constraint mean?(i.e. constraint了什麼)

what is the meaning of "a key for a relation if this is not true for any subset of the key"??

1 Answer

Rating
  • ?
    Lv 7
    1 decade ago
    Favorite Answer

    1 and 2. entity 是一個物件而已, 而entity set則是代表所有同類型物件. 例子: 小弟是系統管理員; 小弟便是entity; 系統管理員是entity set. 你可當作entity set是database內的table; 而entity便是record (但不一定, 因physical 層面可跟erd是有出入的; 因為當中會做了拆table或合併table; 這方面知識是建基於normal form)

    3 and 4. relationship與relationship set同理. relationship是entity之間的關系; 而對應entity set便是relationship set. 聽上去很抽象.... 說一個簡單的例子就很容易明白. 1. 學生上課; 2.陳大文上中文課; 3. 陳小文上數學課. 第1是relationship set. (學生及課堂都是entity set); 後二者便是relationship了.

    2008-12-12 15:42:41 補充:

    都是用回英文好點.

    candidate key is a set of columns to identify a row. there can be more than one candidate key. A table only can one primary key. It will be chosen from all candidate key of a table.

    2008-12-12 15:42:58 補充:

    Theoretically, A table should be normallized to 3nf. but in actual implementation, it may not necessary to make all tables normalized because it will let coding implementation more complicated.

    2008-12-12 15:43:01 補充:

    Then how could we decide wheather to normalize a table? if the column need to be managed by user then it should be normalized. otherwise, if just a set of fields internal used, no need to normalize.

    2008-12-12 15:48:46 補充:

    candidate key is also a super key. but it is a minimal super key. that means.

    2008-12-12 15:48:50 補充:

    e.g. a table called book. (assume book name is uniquie). the field like following.

    book_id, bookname, author, publisher.

    book_id and bookname is candidate key.

    (book_id), (book_id, author), (book_id, publisher), (book_id, book_name) etc. are super key.

    2008-12-12 16:03:13 補充:

    a constraint is the rule set in a table. primary key is also a constraint because it set the column cannot hold duplicated value. i.e. whenever a constraint built, any row modification must satisfy the constraint rules.

    2008-12-12 16:07:35 補充:

    i don't understand the last statement. according to my memory. a relationship should be build between a the primary key in parent table and the same field make reference to parent table. it is so call foreign key.

Still have questions? Get your answers by asking now.