Entity-Relationship (ER) Diagrams Converting ER Diagrams to relational data model: 1. Convert each entity to a new relation R Map entity keys to key for relation R Map all other attributes to attributes for relation R 2. Convert relationships based on cardinality One-to-one/One-to-many: Map to the entity E1 that has one of the other entity E2 by adding E2's key as an attribute. One-to-one: You can add in either direction, but if one side is 1..1, then use the key for that entity (since it will always have values.) Many-to-many: Create a new relation R: include in R the keys of all joining entities. The key must include the key of all entities that have an N participation. -> If relationships had attributes, then add these as attributes to the relation that this relationship was mapped to. ---------------------- Students(RIN, Name, Class, Email) Key: RIN Classes(CN, Semester, Year, Section, CourseCode) Key: CRN Major(Name, offeredby_dcode) Key:Name Departments(dcode,name, phone, location, head_RIN, headStartDate, termLength) Key: dcode FacultyStaff(RIN, Name, Email, Title, WorkIn_dcode) Key: RIN Courses(code, title) Key: code StudentsHaveMajors(RIN, MajorName) Key: RIN, MajorName TakesClasses(RIN, CRN, Grade) Key: RIN, CRN AdvisedBy(StudentRIN, FacultyRIN, MajorName) Key: StudentRIN, MajorName ----