Relationships and Entity-Relationship diagrams Flashcards
What is an entity-relationship diagram?
A layout, wireview, of the database to plan it before coding.
What does the ERD include?
entities, relationships, attributes, keys, types of relationships.
How do you draw an entity symbol on an ERD?
A rectangle with a horizontal line at the top. Above the line is the entity name, below the line is the attributes, beginning with the primary key.
How do you indicate a primary key when hand drawing an ERD?
underlining, starring with * before the name, bolding, marking PK after the attribute name, coloring it differently.
How are foreign keys denoted in a hand drawn ERD?
sometimes in italics, but normally the traditional naming convention.
Name some of the different syntaxes used to describe an ERD.
Access, Chen, UML, Booch, Yourdon, etc.
How do you denote a relationships between entities in an ERD?
a line between the two. From the primary key to the foreign key as closely as possible.
How is a one to many relationship denoted in ERD?
The primary key side gets a single line, but the foreign key side shows crows feet to denote the many side of the relationship.
What is a one-to-one relationship and how is it shown on the ERD?
A one to one relationship is one record type can only have one of another record type. These are rare. They are shown by a single bar on both sides of the line.
What is a many to many relationship and how is it denoted on an ERD?
A many to many relationship is one record type being able to have many of another record type and vice versa. A good example is a student can have many courses and a course can have many students. Shown with crows feet on both sides of the ERD relationship line. Must be converted to two one to many relationships using a junction table on the ERD.
How is a junction table formed?
Must include at least the primary keys of the two parent tables. If a combination of the two primary keys is unique it can be used as the table’s primary key. However, if duplicates can occur you would have to create a unique artificial key or use more information as a composite key.