Database Systems for Data Science
(CS30007):
Introduction to Database Systems for
Data Science
Level: 300
Credit: 2
Domain: Data Science
Instructor: Manjish Pal
Why Databases Matter in Data Science ?
● Data is foundational to all stages of data science
● Raw data → Clean data → Insights → Action
● DBs offer scalability, query efficiency, integrity
● Pipeline (Data Collection → Storage → Analysis → Visualization)
Database Applications - Examples
Database Application - Examples
Purpose of Database Systems
Purpose of Database Systems
ACID Properties of Databases
ATOMICITY
Definition: All parts of a transaction are treated as a single unit
that either fully happens or does not happen at all.
● If one part of a transaction fails, the entire transaction is rolled
back.
● No partial transactions are ever saved in the database.
Example:
Transferring ₹1000 from Account A to Account B. Either both the
debit from A and credit to B happen, or neither does.
ACID Properties of Databases
CONSISTENCY
Definition: A transaction takes the database from one valid state to
another, maintaining all predefined rules and constraints.
● Constraints like primary keys, foreign keys, and unique values are
always enforced.
● The database cannot be left in an invalid state.
Example:
If a transaction inserts a duplicate primary key, it must be rejected,
ensuring consistency of data rules.
ACID Properties of Databases
ISOLATION
● Definition: Transactions are isolated from one another and execute
independently.
○ Intermediate states of a transaction are invisible to other transactions.
○ Prevents issues like dirty reads, non-repeatable reads, and phantom reads.
● Example:
Two users booking the last movie ticket at the same time will not both succeed
— isolation ensures only one booking is confirmed.
ACID Properties of Databases
DURABILITY
Definition: Once a transaction is committed, its changes are
permanent—even if the system crashes afterward.
● Data is written to non-volatile storage (like disk).
● Ensures recovery from failure without data loss.
Example:
After a successful bank transaction, even if the server crashes
immediately, the transaction remains recorded.
Data Models
Relational Model
A Sample Relational Database
View of Data
Instances and Schemas
Data Definition Language (DDL)
Data Manipulation Language (DML)
Data Manipulation Language
SQL (Structured Query Language)
Database Access from Application Program
Database Design and Database Engine