COMP3311 Week 1 Wednesday Lecture

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [0/16]
❖ In today's lecture ...

Topics:

Reminders:
COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [1/16]
❖ CSE Environment


[Diagram:Pics/misc/environ.png]

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [2/16]
❖ ER Model (recap)

ER models give a visual representation of database structure

Primary components

ER models don't capture all information from the scenario

ER models are useful as a step towards an SQL schema

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [3/16]
❖ ER Model (recap) (cont)

ER design elements:

[Diagram:Pics/er-rel/er-symbols.png]

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [4/16]
❖ ER Model (recap) (cont)

Relationships:

[Diagram:Pics/er-rel/cardExs.png]


Thick line = total participation;   thin line = partial participation

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [5/16]
❖ Exercise: ER Diagram

Using the ER diagram below

[Diagram:Pics/er-rel/ER-summary.png]

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [6/16]
❖ Exercise: ER Models


For each of the informal data models

give a suitable ER diagram
COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [7/16]
❖ Class Hierarchies

ER also implements super-class / sub-class hierarchies

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [8/16]
❖ Class Hierarchies (cont)

ER class hierarchies use circle to connect super/sub-classes:


[Diagram:Pics/er-rel/class-hierarchy.png]

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [9/16]
❖ Class Hierarchies (cont)

Consider a concrete example of a class hierarchy:


[Diagram:exercises/stu-lec.png]

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [10/16]
❖ Exercise: Student/Lecturer Class Hierarchy


Modify the student-lecturer class hierachy to represent

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [11/16]
❖ Developing ER Models


A complete ER model should ...

There are frequently different kinds of people (⇒ sub-classes)
COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [12/16]
❖ Exercise: Medical Information

Develop an ER model for the following scenario:

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [13/16]
❖ Data Models

Entity-relationship (ER) model

Relational model SQL schemas
Also ODL, UML, and a variety of others ... but not in this course.
COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [14/16]
❖ Relational Model

Attribute = data item with a name and a type/domain

Tuple = list of values   (cf. Python tuples, C  structs) Relation = set of tuples Constraint = logical statements on valid data
COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [15/16]
❖ Relational Model (cont)


Correspondence between ER and Relational models:

COMP3311 23T3 ♢ Week 1 Wednesday Lecture ♢ [16/16]


Produced: 13 Sep 2023