DBMS Notes
DBMS Notes
Definition: File system stores data in files; DBMS is software for creating and
managing databases.
Example: File system - Excel sheets; DBMS - MySQL for online banking.
Advantages:
o DBMS: Better data integrity, security.
o File system: Simpler for small tasks.
Disadvantages:
o DBMS: Complex and costly.
o File system: No data independence.
Definition:
o Data Model: Blueprint of database structure.
o Schema: Logical design.
o Instance: Snapshot of data.
Example: ER model for college database.
4. Data Independence
Definition:
o DDL (Data Definition Language): Defines structure.
o DML (Data Manipulation Language): For data operations.
8. ER Model Concepts
9. Mapping Constraints
Definition:
o Super Key: Uniquely identifies a row.
o Candidate Key: Minimal super key.
o Primary Key: Chosen candidate key.
Example: Student_ID in student table.
3. Integrity Constraints
Types:
o Entity Integrity: No null in primary key.
o Referential Integrity: Foreign key must refer to existing primary key.
o Domain Constraint: Attribute values must be from defined domain.
Flowchart: SQL Basics → Commands & Operators → Tables & Views → Queries & Joins
→ Procedures & Triggers → Normalization
5. Deadlock Handling
2. Distributed DB
Definition: A file system stores data in files manually, while a DBMS is software
used to create and manage databases.
Example: Storing student records in Excel (file system) vs using MySQL (DBMS).
Definition:
o Data Model: Blueprint for how data is structured.
o Schema: Design of the database.
o Instance: Actual data at a moment.
Example: A college ER diagram (schema), and the student entries (instances).
4. Data Independence
Definition: The complete organization of data elements like tables, views, and
indexes.
Example: A banking system with multiple tables and reports.
8. ER Model Concepts
9. Mapping Constraints
Definition: Rules that define the relationship types like one-to-one, one-to-many.
Example: A teacher (one) teaches many students (many).
Unit II: Relational Data Model and Language (Definitions with Examples)
Definition:
o Super Key: Any set of attributes that uniquely identifies a row.
o Candidate Key: Minimal super key.
o Primary Key: Main unique identifier.
Example: Student_ID in a student table.
3. Integrity Constraints
Definition:
o Relational Algebra: Uses operations to query data.
o Relational Calculus: Uses logic to describe queries.
Example: Selecting rows using projection and selection.
5. Tuple and Domain Calculus
Definition: Data types define the type of data (like number, text).
Example: INT for age, VARCHAR for name.
Definition:
o Table: Stores data.
o View: Virtual table from query.
o Index: Speeds up searching.
Example: Product table with index on price.
Definition:
o Query: Request to get data.
o Subquery: Query inside another query.
o Aggregate Function: Performs calculations like AVG.
Example: AVG(salary) to get average salary.
Definition:
o Cursor: Points to query result.
o Trigger: Auto action on data change.
o Procedure: Stored group of SQL statements.
Example: Trigger to auto-update stock after sale.
Definition:
o Log: Record of changes.
o Checkpoint: Save point in DB.
Example: Restore game to last save point.
5. Deadlock Handling
Definition: Handling situations where two transactions wait for each other forever.
Example: Two people trying to reserve the last seat.
Definition:
o Centralized: All data on one server.
o Client-Server: Tasks divided between client and server.
Example: ATM network uses client-server.
2. Distributed DB
Definition:
o Spatial: Stores map-based data.
o Temporal: Stores time-based data.
Example: Google Maps uses spatial DB.
Definition:
o Mobile DB: For mobile apps.
o Web DB: For web services.
o Active DB: Reacts to events.
Example: Mobile banking app uses mobile DB.
1. DBMS Architecture
+-----------------------+
| User/Application |
+----------+------------+
|
+----------v------------+
| DBMS (Software Layer)|
+----------+------------+
|
+----------v------------+
| Database Storage |
+-----------------------+
Start → Check Entity Integrity (Primary Key not NULL) → Check Referential
Integrity (Foreign Key matches PK) → Check Domain Constraints
Start → Parse Query → Optimize Query Plan → Execute Query → Return Result
3. Normalization Steps
Start → 1NF (Atomic values) → 2NF (Full dependency) → 3NF (No transitive
dependency)
Unit IV: Transaction Processing (Flowcharts)
1. Transaction Lifecycle
Definition Any key that uniquely identifies rows Minimal super key Selected candidate key
Join Combine rows from two tables Related data from both tables
Data Storage One central location Divided between client & server
Access Speed May be slower for remote Faster access with network
Data Type Objects with attributes & methods Tables with rows & columns
DBMS Managing complex data with multiple users Banking Systems (e.g., ICICI Bank
Architecture accessing data simultaneously Core DBMS)
Concurrency Ensuring accuracy during simultaneous data Stock Trading Platforms like
Protocols access NSE/BSE
Web & Mobile Accessing live databases from Zomato, WhatsApp Real-Time
Databases web/mobile apps Chat DB
Multimedia & XML Storing images, audio, video, and YouTube Media Storage, News
Databases hierarchical data Aggregators