Lecture 2: Data Models
An Introduction to the Relational Model
Amit Kumar Dhar
July 31, 2025
1
What is a Data Model?
• A data model is a collection of concepts for describing data.
• It provides a way to describe the design of a database at the
physical, logical, and view levels.
• It is a set of tools for describing:
• Data
• Data relationships
• Data semantics
• Data constraints
2
Categories of Data Models
• Record-Based Data Models:
• Data is organized in fixed-format records of several types.
• Examples: Relational Model, Network Model, Hierarchical
Model.
• Object-Based Data Models:
• Use concepts such as entities, attributes, and relationships.
• Example: Entity-Relationship (ER) Model.
• Physical Data Models:
• Describe data at the lowest level (how it is stored on disk).
3
Hierarchical Model
• Data is organized into a tree-like structure.
• The data is stored as records which are connected to one
another through links.
• A record is a collection of fields, with each field containing
only one value.
• A child record can only have one parent.
Database
Relational Document
SQLite MySQL Solr
4
Network Model
• Similar to the hierarchical model, but a child record can have
multiple parents.
• This allows for more complex relationships to be modeled.
• Data is organized in a graph structure.
CSL100
CSL202 CSL252
CSL301
5
The Relational Model
• Proposed by E.F. Codd in 1970.
• The most widely used data model.
• Data is organized into tables, which are called relations.
• A relation is a set of tuples (rows), where each tuple is a set
of attribute (column) values.
6
Example Relation: Students
StudentID FirstName LastName ldap
12340070 Parth Smith parth
12340150 Isha Parekh isha
12340630 Juhi Khan juhik
7
Relational Model Terminology
Column/Attribute/Field
StudentID FirstName LastName ldap
12340070 Parth Smith parth
12340150 Isha Parekh isha
12340630 Juhi Khan juhik
Row/Tuple/Record
8
More Terminology
• Domain: The set of allowed values for each attribute.
• Example: The domain of ‘StudentID‘ might be the set of all
3-digit integers.
• Degree: The number of attributes in a relation.
• The ‘Students‘ relation has a degree of 4.
• Cardinality: The number of tuples in a relation.
• The ‘Students‘ relation has a cardinality of 3.
9
Schema vs. Instance
• Schema: The logical design of the database. It specifies the
name of the relation and the name and type of each attribute.
• Example: ‘Students(StudentID: integer, FirstName: string,
LastName: string, ldap: string)‘
• Instance: The actual data in the database at a particular
point in time.
• The table we saw earlier is an instance of the ‘Students‘
relation.
10
Keys in the Relational Model
A key is a way to uniquely identify tuples in a relation.
• Superkey: An attribute, or a set of attributes, that uniquely
identifies a tuple.
• Candidate Key: A minimal superkey (no proper subset is a
superkey).
• Primary Key: A candidate key that is chosen by the database
designer as the principal means of identifying tuples.
11
Example of Keys
StudentID FirstName LastName ldap
12340070 Parth Smith parth
12340150 Isha Parekh isha
12340630 Juhi Khan juhik
Superkey StudentID FirstName LastName ldap
12
Example of Keys
StudentID FirstName LastName ldap
12340070 Parth Smith parth
12340150 Isha Parekh isha
12340630 Juhi Khan juhik
Candidate Key StudentID ldap
12
Example of Keys
StudentID FirstName LastName ldap
12340070 Parth Smith parth
12340150 Isha Parekh isha
12340630 Juhi Khan juhik
Primary Key
StudentID
Choice
12
Foreign Keys
• A foreign key is a key used to link two tables together.
• It is a field (or collection of fields) in one table that refers to
the primary key in another table.
• This is how we create relationships between relations.
13
Foreign Key Example
Enrollment
Students
CourseID StudentID
StudentID Name
CSL300 12340070
12340070 Parth
CSL300 12340150
12340150 Isha
CSL312 12340070
14
Thank You!!
Questions?
14