1 / 14

BACS 485

BACS 485. Translating E/R to Relational Notation. Relational Notation.

marek
Télécharger la présentation

BACS 485

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BACS 485 Translating E/R to Relational Notation

  2. Relational Notation Relational Notation is a shorthand way to represent E/R diagrams. It is a half-way step between an abstract tool (i.e., E/R diagrams) and an implementation specific tool (i.e., SQL Create Table commands). The format is as follows: Table-name(key-attribute, attribute-1,… attribute-N)

  3. Relational Notation The basic rules of translating E/R diagrams to Relational Notation are given below: • Each entity becomes a table • Each attribute on the table becomes an attribute on the table • Primary keys are underlined • Foreign keys are underlined with a dashed line • In 1:1, the foreign key can be on either side of the relation (context dependent) • In 1:N, the foreign key goes on the ‘N’ side • In M:N, the relation becomes a table and the key for the new table is the concatenated primary keys of the original tables • In sub-type/super-type, the primary key of the sub-type(s) is the same as the super-type (thus, no “foreign key”)

  4. 1:1E/R to Relational Notation • Translates to 2 tables:Table1 (A,B,C,D) OR Table1 (A,B,C)Table2 (D,E,F) Table2 (D,E,F,A) pick one depending upon context, dashed underlined letter is foreign key

  5. 1:1Relational Notation to E/R • Translate from 2 tables: Table1 (X,Y,Z) OR Table1 (X,Y,Z,L) Table2 (L,M,N,X) Table2 (L,M,N) pick one depending upon context, dashed underlinedletter is foreign key

  6. 1:NE/R to Relational Notation • Translates to 2 tables:Table1 (A,B,C) Table2 (D,E,F,A)dashed underlinedletter is foreign key

  7. 1:NRelational Notation to E/R • Translate from 2 tables: Table1 (X,Y,Z,L) Table2 (L,M,N) dashed underlinedletter is foreign key

  8. Simple M:NE/R to Relational Notation • Translates to 3 tables:Table1 (A,B,C) Table2 (D,E,F)Table3 (A,D) Notice that there is no foreign key

  9. Simple M:NRelational Notation to E/R • Translate from 3 tables: Table1 (X,Y,Z) Table2 (L,M,N) Table3 (X,L)

  10. More Complex M:NE/R to Relational Notation • Translates to 3 tables:Table1 (A,B,C) Table2 (D,E,F)Table3 (A,D,X) Notice that relationship attribute is attached to new table

  11. More Complex M:NRelational Notation to E/R • Translate from 3 tables: Table1 (X,Y,Z) Table2 (L,M,N) Table3 (X,L,P)

  12. More Complex M:NE/R to Relational Notation • Translates to 3 tables:Table1 (A,B,C) Table2 (D,E,F)Table3 (A,D,X) Notice that relationship attribute is attached to new table

  13. More Complex M:NE/R to Relational Notation • Translates to 4 tables:Table1 (A,B,C) Table2 (D,E,F)Table3 (H,I,J)Table4 (A,D,H,K)

  14. Sub-Type / Super-TypeE/R to Relational Notation • Translates to 3 tables:Table1 (A,B,C) Table2 (A,D,E,F)Table3 (A,H,I,J)Notice that Table2 and Table3 do not have a key in the E/R.

More Related