WEEK 9 - DATABASES AND ENTITY RELATIONSHIP DIAGRAMS (ERD) Flashcards
1
Q
Purpose of data modeling
A
- ensure the business database operates correctly and efficiently
- involves creating a data model, which serves as a “blueprint” for building the database
2
Q
define logical design in data modeling
A
models the database from a business perspective, focusing on the relationships and data flow
3
Q
define physical design in data modeling
A
focuses on how data is organized and stored on physical storage media like hard disks
4
Q
what is a data model
A
- a diagram representing main items of interest (entities) and their relationships
- entity-relationship diagrams (ERDs) are used for visualizing these models
- common notation: Crow’s foot notation
5
Q
define entities
A
- items of interest in the database, usually nouns (eg. students, courses)
- represented as rectangles
6
Q
define attributes
A
- characteristics or properties of an entity (eg. student_name, student_address)
- unique attributes form the primary key of the entity
7
Q
define records
A
- groups of related fields, representing an instance of an entity (eg. a row in a table)
8
Q
define fields
A
- individual pieces of data (eg. a single cell in a table)
9
Q
define foreign key
A
- a field that links tables by referencing the primary key in another table
10
Q
define relationships
A
- connections between entities, defined by business rules
- represented as lines connecting entities in the ERD
11
Q
define cardinality
A
- defines the number of entities in a relationship (minimum and maximum)
- notation: single line (mandatory one), crow’s foot (many) and zero (optional)
12
Q
example of ERD components
A
- entities: represented by rectangles (eg. lecturer, course)
- attributes: characteristics of entities (eg. lecture ID, course name)
- relationships: lines connecting entities with cardinality notation
example: - lecturer teaches courses
- one-to-many relationship: a lecturer can teach many courses, but a course is taught by one lecturer
13
Q
steps in building an ERD
A
- identify entities and relationships
- create a preliminary data model (without detailed attributes or data types)
- iterate and refine the model based on feedback and analysis
14
Q
example scenarios of building an ERD
A
- English premier league: Players, Clubs, Sponsors etc
- motor vehicle ownership: owners, vehicles, policies, claims etc
15
Q
common relationship types
A
- one-to-many: eg. customer places many orders
- many-to-many: requires linking entity to resolve
- one-to-one: a course has one lecturer