Programming Exercise I Construction (Cont.)

  1. MySQL Relational Database Design (Cont.)
  2. For example, a many-to-many (N-N) relationsnship has a student take many courses and a course be taken by many students. Below gives its ER diagram, where

    • ▭ is an entity,
    • ◇ is a relationship,
    • ⬭ is an attribute, and
    • (minimum cardinality, maximum cardinality). Cardinality expresses the specific number of entity occurrences associated with one occurrence of the related entity; e.g., a minimum cardinality of 0 indicates that the relationship is optional.


    Transforming (N-N relationship)
    course
    cid title room credit
    CSCI260 .NET and World Wide Web Programming CEC 205 3
    DATA520 Databases Upson II 265 3
    DATA525 Data Engineering and Mining Harrington 218 3
    CSCI513 Advanced Databases CEC 205 3
    ... ... ... ...
     
    student
    sid name email
    1 Super Mario super.mario@und.edu
    2 Poke Mon poke.mon@ndus.edu
    110 Digi Mon digi.mon@und.edu
    24 Sponge Bob sponge@gmail.com
    ... ... ...
    take
    sid cid semester
    36 CSCI260 Fall 2022
    2 DATA520 Spring 2022
    2 CSCI513 Fall 2023
    38 CSCI370 Spring 2023
    ... ... ...