Search code examples
databasedatabase-designmappingrelationalentity-relationship

Converting an ER diagram into relational scheme


Currently I'm learning about relational schemes and I converted following ER diagram into a one yet I feel something is missing. I would like to know If I did it correctly or missing anything?

ER diagram

and here is the relational scheme I did

Relational scheme diagram


Solution

  • In true ER (entity-relationship) modeling/diagramming methods, a diamond is an association/relationship type, a box is an entity type & a line is a participation/FK, and every box (entity) & diamond (relationship) type gets a table. Your schema does not reflect your diagram. Generally diamondless methods call themselves "ER", and call FKs "relationships", but they are really just describing database schemas. (Although there is nothing wrong with that per se.) They would use just lines denoting FKs for your M:1 diamonds & lines, but for M:M diamonds they would use a box.

    Your schema does not properly represent your M:M association/relationship "Include". How would your schmea record that a certain reservation includes certain rooms? Multiple reservation rows with different RIDs would contradict your PK (primary key), be poorly normalized, and not reflect any method's interpretation of your diagram.

    PS 1 Unless you give a reference to the method/product you're using, we can't tell you whether you've followed it or even interpret your diagram.

    PS 2. Your schema has no more content than your diagram. If a method involves adding info when moving from diagram to schema then there is a point to giving a schema.