Good luck to all of you 🙂. Also I made these notes over night so there might be some issues…
Part I: Structured Data
Entities and Relationships
ER model - only a description. Graphical notation only.
We start with a rectangle. Attributes go to circle.
- Superkey = A set of attributes is a superkey for an entity if those attributes, taken together, always uniquely identify every entity instance. Might have attributes that are not needed for identification.
- Key = A set of attributes is a key if it is a minimal set of identifying attributes — removing any one attribute would make it no longer uniquely identifying.
- Super key = for any instance always unique
- Key = minimal set of identifying each entity
- Candidate Key = we might have more options which keys to use - candidate represents this choice
- Primary key = a candidate key we actually choose.
- Key is a set of attributes. Key made of more than one attribute is called composite key.
- We underline all the keys used to compose the primary key
More on keys here:
ER diagrams are just this bullshit.
Some types of relationships:
- Many to one
- One to many
- Many to many
Key constraint = if a relationship must occur only once. Arrowhead
This means that a student has to be member of lab team but does not need to be a leader. Basically its a not null for foreign key. We indicate this with double line.