🏠 Home 📋 Syllabus 🗂️ Unit I — DBMS Fundamentals 💾 Unit II — SQL 📐 Unit III — Relational Model 🔐 Unit IV — Transactions 🃏 Flashcards 🎯 Quiz ⚡ Quick Revision
Complete Exam Preparation

Master DBMS
From Zero to Viva

Everything you need — concepts, SQL, normalization, transactions, quizzes & quick revision notes. Built for college students.

0
Units
0
MCQs
0
Flashcards
0
+ Topics
Overview

Syllabus at a Glance

Four units covering everything from DBMS basics to advanced transactions

Unit I
🗂️

DBMS Fundamentals

Intro to DBMS, ER Model, Entities, Attributes, Keys, Relationships, Architecture

  • DBMS Overview & Architecture
  • ER Diagrams & Entities
  • Keys & Relationships
  • Data Models
12 Topics
Unit II
💾

SQL & Queries

Complete SQL — DDL, DML, DCL, Joins, Views, Triggers, Stored Procedures

  • SQL Commands (DDL/DML/DCL)
  • Joins & Nested Queries
  • Views, Triggers, Indexes
  • Integrity Constraints
18 Topics
Unit III
📐

Relational Model & Normalization

Relational Algebra, Calculus, Functional Dependencies, 1NF–BCNF

  • Relational Algebra
  • Codd's Rules
  • Normalization 1NF–BCNF
  • ER to Relational Mapping
15 Topics
Unit IV
🔐

Transactions & Security

ACID Properties, Recovery, Security, Authorization, NoSQL Databases

  • Transaction Processing
  • ACID Properties
  • Recovery Techniques
  • NoSQL Databases
10 Topics

📊 Your Learning Progress

Unit I
0%
Unit II
0%
Unit III
0%
Unit IV
0%
Unit I

🗂️ DBMS Fundamentals & ER Model

📌

Overview of DBMS

▾
Definition: A Database Management System (DBMS) is software that manages a collection of interrelated data and provides an easy, efficient way to store, retrieve, and modify data.

Think of a library — the books are the data, and the librarian system (catalog, borrowing records) is the DBMS. Without a DBMS, you'd store data in flat files, which makes searching, updating, and securing data extremely difficult.

Why DBMS instead of File Systems?

File SystemDBMS
Data redundancy (same data stored multiple times)Controlled redundancy
No consistency enforcementData consistency guaranteed
No multi-user access controlConcurrent access control
No backup/recoveryBuilt-in recovery mechanisms
Data dependent on programsData independence

Characteristics of DBMS

🔄Data Sharing

Multiple users can access data simultaneously

🔐Data Security

Access controls prevent unauthorized access

⚡Data Integrity

Accuracy and consistency of data

🔗Data Independence

Changes in schema don't affect programs

📉Reduced Redundancy

Normalized storage prevents duplication

🔁Backup & Recovery

Automatic recovery from failures

📝 Quick Note: DBMS examples: MySQL, Oracle, PostgreSQL, MongoDB, SQL Server. MySQL is most common in college exams.
🎙️ Viva Questions:
  1. What is DBMS? How is it different from a file system?
  2. Name any 4 characteristics of DBMS.
  3. What is data redundancy? How does DBMS control it?
  4. Give two real-world examples where DBMS is used.
🏛️

DBMS Architecture (3-Level / ANSI-SPARC)

▾
Definition: The ANSI/SPARC architecture defines 3 levels of abstraction — External, Conceptual, and Internal — to separate how data looks to users, how it's logically structured, and how it's physically stored.
External Level (View Level)
User View 1
User View 2
User View 3

What individual users see — customized views

↓ External/Conceptual Mapping ↓
Conceptual Level (Logical Level)
Complete Logical Schema — all entities, relationships

DBA's view — logical structure of entire database

↓ Conceptual/Internal Mapping ↓
Internal Level (Physical Level)
Physical Storage — files, indexes, blocks

How data is actually stored on disk

Data Independence

TypeDescriptionExample
LogicalChanges in conceptual schema don't affect external viewsAdding a new column doesn't break existing apps
PhysicalChanges in storage don't affect conceptual schemaChanging file organization doesn't affect logic

Client/Server Architecture

🖥️ Client
Sends SQL queries
Displays results
←→ Network →←
🗄️ Database Server
Processes queries
Manages data
🎙️ Viva Questions:
  1. What are the 3 levels of DBMS architecture?
  2. What is data independence? Name its types.
  3. What is the difference between schema and instance?
  4. Explain client/server architecture in DBMS.
🗺️

Data Models

▾
Definition: A data model is a collection of concepts that describe the structure of a database — how data is organized and what constraints must hold.
ModelDescriptionExample
HierarchicalTree structure, parent-child relationshipsIBM IMS
NetworkGraph structure, record types with setsIDMS
RelationalTables with rows and columnsMySQL, Oracle
Object-OrientedObjects with attributes and methodsdb4o
ER ModelEntities, attributes, relationshipsConceptual design
📝 Quick Note: The Relational Model is most important for your exam. It was proposed by E.F. Codd in 1970.
🔷

ER Model — Entities & Attributes

▾
Entity: A real-world thing or object about which data is stored. Example: Student, Employee, Book, Car
Entity Type: A collection of entities that share the same attributes. Example: STUDENT is an entity type; "Rahul" is an entity (instance).

Types of Attributes

TypeDescriptionExampleER Symbol
SimpleCannot be divided furtherAge, Roll NoOval
CompositeCan be divided into sub-partsName → First, LastOval + sub-ovals
DerivedComputed from other attributesAge (from DOB)Dashed oval
Multi-valuedCan have multiple valuesPhone numbersDouble oval
KeyUniquely identifies entityStudent IDUnderlined oval

Sample ER Diagram — STUDENT

STUDENT
Student_ID
(Key)
Name
(Composite)
Age
(Derived)
Phone
(Multi-valued)
Address
(Simple)
🎙️ Viva Questions:
  1. What is the difference between entity, entity type, and entity set?
  2. What is a derived attribute? Give an example.
  3. What is a composite attribute?
  4. How is a multi-valued attribute represented in an ER diagram?
🔑

Keys in DBMS

▾

Keys are used to uniquely identify records in a table. Understanding keys is extremely important for your exam.

🔑 Super Key

A set of one or more attributes that can uniquely identify a tuple.

Student(Roll, Name, Email)
Super Keys: {Roll}, {Email}, {Roll, Name}

🗝️ Candidate Key

A minimal super key — no proper subset of it is a super key.

If Roll and Email both uniquely identify:
Candidate Keys: {Roll}, {Email}

🏆 Primary Key

One candidate key chosen by the DBA. Cannot be NULL.

PRIMARY KEY (Roll_No)
— one value per student, never null

🔗 Foreign Key

An attribute that references the primary key of another table.

Enrollment.Student_ID → Student.Student_ID

🔄 Alternate Key

Candidate keys that are not chosen as the primary key.

If Roll is PK, then Email is an alternate key.

🧩 Composite Key

A primary key made of two or more attributes.

PRIMARY KEY (Student_ID, Course_ID)
— in Enrollment table
📝 Trick: Super Key ⊇ Candidate Key ⊇ Primary Key. All candidate keys are super keys, but not vice versa.
🎙️ Viva Questions:
  1. What is the difference between super key and candidate key?
  2. Can a foreign key have NULL values?
  3. What is a composite key?
  4. Why can't a primary key be NULL?
🔗

Relationships, Weak Entities, Specialization & Generalization

▾
Relationship: An association between two or more entities. Example: Student ENROLLS IN Course

Cardinality Ratios

TypeNotationExample
One-to-One (1:1)1:1Person — Passport
One-to-Many (1:N)1:NDepartment — Employees
Many-to-One (N:1)N:1Employees — Manager
Many-to-Many (M:N)M:NStudents — Courses

Weak Entity

Weak Entity: An entity that cannot be uniquely identified by its own attributes alone — it depends on a strong (owner) entity.
Example: Dependent (child) of an Employee. Represented with double rectangle in ER diagrams.

Specialization vs Generalization

PERSON (Generalization ↑)
▼ Specialization ▼
STUDENT
EMPLOYEE
TEACHER
FeatureSpecializationGeneralization
DirectionTop-downBottom-up
ProcessHigher entity → sub-entitiesCommon entities → higher entity
ExampleVEHICLE → Car, Truck, BikeCar, Truck, Bike → VEHICLE
🎙️ Viva Questions:
  1. What is a weak entity? Give an example.
  2. Difference between specialization and generalization?
  3. What is a partial key (discriminator)?
  4. What is participation constraint (total vs partial)?

📝 Important Long Questions — Unit I

5 marks

Explain the 3-level architecture of DBMS with a neat diagram. What are the advantages of this architecture?

5 marks

What is an ER diagram? Explain all types of attributes with examples and ER notations.

10 marks

Explain the ER model in detail. Draw an ER diagram for a University database with Students, Courses, Departments, and Faculty entities.

10 marks

Explain all types of keys in DBMS with examples. What is data independence? Explain its types.

5 marks

What is the difference between specialization and generalization? Explain with an example.

Unit II

💾 SQL & Database Queries

💡

SQL Overview & Command Types

▾
SQL (Structured Query Language) is the standard language for managing and manipulating relational databases. It was originally developed at IBM and is based on relational algebra.
DDL — Data Definition
CREATEALTERDROPTRUNCATERENAME
DML — Data Manipulation
SELECTINSERTUPDATEDELETE
DCL — Data Control
GRANTREVOKE
TCL — Transaction
COMMITROLLBACKSAVEPOINT

DDL Examples

DDL — Create, Alter, Drop
-- Create a table
CREATE TABLE Students (
    Student_ID  INT          PRIMARY KEY,
    Name        VARCHAR(100) NOT NULL,
    Branch      VARCHAR(50)  DEFAULT 'CSE',
    Marks       DECIMAL(5,2) CHECK (Marks >= 0 AND Marks <= 100),
    Email       VARCHAR(100) UNIQUE
);

-- Add a new column
ALTER TABLE Students ADD Phone VARCHAR(15);

-- Modify column type
ALTER TABLE Students MODIFY Marks FLOAT;

-- Drop a column
ALTER TABLE Students DROP COLUMN Phone;

-- Delete all data but keep structure
TRUNCATE TABLE Students;

-- Delete table completely
DROP TABLE Students;

DML Examples

DML — Insert, Update, Delete, Select
-- INSERT
INSERT INTO Students VALUES (101, 'Rahul', 'CSE', 89.5, 'rahul@email.com');
INSERT INTO Students (Student_ID, Name) VALUES (102, 'Priya');

-- UPDATE
UPDATE Students SET Marks = 92 WHERE Student_ID = 101;
UPDATE Students SET Branch = 'IT' WHERE Branch = 'CSE' AND Marks < 60;

-- DELETE
DELETE FROM Students WHERE Student_ID = 102;
DELETE FROM Students WHERE Marks < 40;

-- SELECT with conditions
SELECT Name, Marks FROM Students WHERE Branch = 'CSE';
SELECT DISTINCT Branch FROM Students;
SELECT * FROM Students WHERE Marks BETWEEN 60 AND 90;
SELECT * FROM Students WHERE Name LIKE 'R%';
SELECT * FROM Students WHERE Branch IN ('CSE', 'IT', 'ECE');
📝 DELETE vs TRUNCATE vs DROP:
DELETE — removes rows (can use WHERE, can ROLLBACK) | TRUNCATE — removes ALL rows fast (cannot WHERE/ROLLBACK) | DROP — deletes entire table including structure
📊

GROUP BY, HAVING & Aggregate Functions

▾
GROUP BY & HAVING
-- GROUP BY: groups rows that have same values
SELECT Branch, COUNT(*) AS Student_Count, AVG(Marks) AS Avg_Marks
FROM Students
GROUP BY Branch;

-- Output:
-- Branch | Student_Count | Avg_Marks
-- CSE    | 3             | 87.00
-- IT     | 1             | 85.00

-- HAVING: filter AFTER grouping (like WHERE but for groups)
SELECT Branch, AVG(Marks) AS Avg_Marks
FROM Students
GROUP BY Branch
HAVING AVG(Marks) > 80;  -- only branches with avg > 80

-- ORDER BY: sort results
SELECT Name, Marks FROM Students ORDER BY Marks DESC;
SELECT Name, Marks FROM Students ORDER BY Marks ASC LIMIT 3;

Aggregate Functions

SELECT COUNT(*) FROM Students;          -- 4 (total rows)
SELECT COUNT(Email) FROM Students;      -- counts non-null emails
SELECT SUM(Marks) FROM Students;        -- sum of all marks
SELECT AVG(Marks) FROM Students;        -- average
SELECT MAX(Marks) FROM Students;        -- highest
SELECT MIN(Marks) FROM Students;        -- lowest
📝 WHERE vs HAVING:
WHERE filters BEFORE grouping | HAVING filters AFTER grouping
WHERE cannot use aggregate functions | HAVING can use aggregate functions
🛡️

Integrity Constraints

▾
ConstraintDescriptionExample
PRIMARY KEYUnique + NOT NULL identifierPRIMARY KEY (Student_ID)
NOT NULLColumn cannot have NULL valueName VARCHAR(100) NOT NULL
UNIQUEAll values must be distinct (allows NULL)Email VARCHAR(100) UNIQUE
CHECKValue must satisfy a conditionCHECK (Age >= 18)
DEFAULTProvides default value if none givenBranch VARCHAR(50) DEFAULT 'CSE'
FOREIGN KEYReferences primary key of another tableFOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
Referential Integrity Example
CREATE TABLE Department (
    Dept_ID   INT          PRIMARY KEY,
    Dept_Name VARCHAR(100) NOT NULL
);

CREATE TABLE Employee (
    Emp_ID   INT           PRIMARY KEY,
    Emp_Name VARCHAR(100)  NOT NULL,
    Dept_ID  INT,
    Salary   DECIMAL(10,2) CHECK (Salary > 0),
    FOREIGN KEY (Dept_ID) REFERENCES Department(Dept_ID)
        ON DELETE CASCADE    -- if dept deleted, employees also deleted
        ON UPDATE CASCADE    -- if dept_id updated, update here too
);
🔀

SQL Joins (MOST IMPORTANT)

▾

Joins are used to combine rows from two or more tables based on a related column.

A
B
INNER JOIN
A
B
LEFT JOIN
A
B
RIGHT JOIN
A
B
FULL OUTER
All JOIN Types with Examples
-- Tables: Students(SID, Name, CID) | Courses(CID, Course_Name)
-- Data: Rahul→101(DBMS), Priya→102(OS), Amit→NULL | 103(CN) has no student

-- INNER JOIN: only matching rows from BOTH tables
SELECT s.Name, c.Course_Name
FROM Students s INNER JOIN Courses c ON s.CID = c.CID;
-- Result: Rahul-DBMS, Priya-OS  (Amit and CN excluded)

-- LEFT JOIN: all from left table, matching from right (NULL if no match)
SELECT s.Name, c.Course_Name
FROM Students s LEFT JOIN Courses c ON s.CID = c.CID;
-- Result: Rahul-DBMS, Priya-OS, Amit-NULL

-- RIGHT JOIN: all from right table, matching from left
SELECT s.Name, c.Course_Name
FROM Students s RIGHT JOIN Courses c ON s.CID = c.CID;
-- Result: Rahul-DBMS, Priya-OS, NULL-CN

-- FULL OUTER JOIN: all rows from both tables
-- (MySQL doesn't support directly, use UNION of LEFT + RIGHT)
SELECT s.Name, c.Course_Name FROM Students s
LEFT JOIN Courses c ON s.CID = c.CID
UNION
SELECT s.Name, c.Course_Name FROM Students s
RIGHT JOIN Courses c ON s.CID = c.CID;

-- CROSS JOIN: every combination (Cartesian product)
SELECT s.Name, c.Course_Name FROM Students s CROSS JOIN Courses c;
-- 3 students × 3 courses = 9 rows

-- SELF JOIN: table joined with itself
SELECT A.Name AS Student, B.Name AS Mentor
FROM Students A JOIN Students B ON A.Mentor_ID = B.SID;
🎙️ Viva Questions:
  1. What is the difference between INNER JOIN and LEFT JOIN?
  2. What is a CROSS JOIN? When is it used?
  3. What is a self join?
  4. How many rows does a CROSS JOIN of 3×4 tables produce?
📥

Nested & Correlated Queries

▾
Nested (Sub) Queries
-- Find students with marks above average
SELECT Name, Marks FROM Students
WHERE Marks > (SELECT AVG(Marks) FROM Students);

-- Find students enrolled in 'DBMS' course
SELECT Name FROM Students
WHERE CID IN (SELECT CID FROM Courses WHERE Course_Name = 'DBMS');

-- Correlated Subquery: inner query references outer query
SELECT Name, Marks FROM Students s1
WHERE Marks > (
    SELECT AVG(Marks) FROM Students s2
    WHERE s2.Branch = s1.Branch  -- references outer query's Branch
);
-- This finds students above the avg of their OWN branch
📝 Difference:
Nested query: Inner query runs ONCE, result used by outer query.
Correlated query: Inner query runs ONCE PER ROW of outer query — slower but more flexible.
🪟

Views, Indexes, Triggers & Stored Procedures

▾
VIEWS — Virtual Tables
-- Create a view showing only CSE students
CREATE VIEW CSE_Students AS
SELECT Student_ID, Name, Marks
FROM Students WHERE Branch = 'CSE';

-- Query the view like a table
SELECT * FROM CSE_Students;

-- Drop a view
DROP VIEW CSE_Students;
INDEXES — Speed Up Queries
-- Create index on Name column
CREATE INDEX idx_name ON Students(Name);

-- Unique index (also enforces uniqueness)
CREATE UNIQUE INDEX idx_email ON Students(Email);

-- Drop index
DROP INDEX idx_name ON Students;
TRIGGERS — Auto-Execute on Events
-- Trigger: log every INSERT into Students
CREATE TRIGGER after_student_insert
AFTER INSERT ON Students
FOR EACH ROW
BEGIN
    INSERT INTO Audit_Log(Action, Student_ID, Log_Time)
    VALUES ('INSERT', NEW.Student_ID, NOW());
END;
STORED PROCEDURES
DELIMITER //
CREATE PROCEDURE GetStudentsByBranch(IN branch_name VARCHAR(50))
BEGIN
    SELECT * FROM Students WHERE Branch = branch_name;
END //
DELIMITER ;

-- Call the procedure
CALL GetStudentsByBranch('CSE');
ObjectDescriptionKey Benefit
ViewVirtual table based on SELECTSecurity, simplification
IndexData structure for fast lookupFaster queries
TriggerAuto-runs on INSERT/UPDATE/DELETEAutomatic actions
Stored ProcedureReusable SQL block with parametersCode reuse, performance
🎙️ Viva Questions:
  1. What is a view? Can you update data through a view?
  2. What is an index? What are its disadvantages?
  3. What is a trigger? Name the types of triggers.
  4. Difference between function and stored procedure?

📝 Important Long Questions — Unit II

5 marks

Explain DDL and DML commands with examples. What is the difference between DELETE and TRUNCATE?

5 marks

What are joins in SQL? Explain INNER JOIN, LEFT JOIN, and RIGHT JOIN with examples and output.

10 marks

Explain GROUP BY and HAVING clauses with examples. Write SQL queries using aggregate functions COUNT, SUM, AVG, MAX, MIN.

10 marks

What are integrity constraints in SQL? Explain PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, and CHECK constraints with examples.

5 marks

What is a view? What are its advantages? Write SQL to create and use a view.

Unit III

📐 Relational Model & Normalization

🗄️

Relational Model — Domains, Attributes, Tuples, Relations

▾
TermFormal NameCommon TermExample
RelationRelationTableStudents table
TupleTupleRow / RecordOne student's data
AttributeAttributeColumn / FieldName, Age, Branch
DomainDomainData type + valid valuesAge: positive integers 1–150
DegreeDegreeNumber of columns5 attributes → degree 5
CardinalityCardinalityNumber of rows100 students → cardinality 100

Codd's 12 Rules (Important!)

0

Foundation Rule: A relational system must manage data using its relational capabilities only.

1

Information Rule: All data is represented as values in tables.

2

Guaranteed Access: Every value accessible by table name, primary key, and column name.

3

Systematic NULL Handling: NULL represents missing/inapplicable information.

4

Active Online Catalog: Schema stored in the same database.

5

Comprehensive Data Sublanguage: At least one language must support DDL, DML, integrity, authorization, transactions.

6

View Updating Rule: All theoretically updatable views must be updatable.

7

High-level Insert/Update/Delete: Must support set-level operations.

8

Physical Data Independence: Application unaffected by storage changes.

9

Logical Data Independence: Application unaffected by logical changes.

10

Integrity Independence: Integrity constraints stored in catalog, not programs.

11

Distribution Independence: System must work the same whether data is distributed or not.

12

Non-subversion Rule: Cannot bypass integrity constraints using low-level language.

🔣

Relational Algebra & Calculus

▾
OperationSymbolDescriptionExample
Selection (σ)σSelects rows satisfying a conditionσBranch='CSE'(Students)
Projection (π)πSelects specific columnsπName,Marks(Students)
Union (∪)∪All tuples from both relations (no duplicates)R ∪ S
Intersection (∩)∩Tuples in BOTH relationsR ∩ S
Difference (−)−Tuples in R but NOT in SR − S
Cartesian Product (×)×All combinations of tuplesR × S
Join (⋈)⋈Natural Join — combine on common attributesR ⋈ S
Division (÷)÷Tuples in R related to ALL tuples in SR ÷ S

Relational Calculus

Tuple Relational Calculus (TRC): Variables represent tuples. Uses quantifiers ∀ (for all) and ∃ (there exists).
{t | P(t)} — set of all tuples t satisfying predicate P.
Example: {t | t ∈ Students ∧ t.Branch = 'CSE'}
Domain Relational Calculus (DRC): Variables represent domain values (attribute values), not tuples.
Example: {⟨n, m⟩ | ∃b (⟨n, b, m⟩ ∈ Students ∧ b = 'CSE')}
📊

Normalization — 1NF, 2NF, 3NF, BCNF (MOST IMPORTANT)

▾
Normalization: The process of organizing a database to reduce redundancy and improve data integrity by decomposing relations into smaller, well-structured relations.

Functional Dependency (FD)

X → Y means "X functionally determines Y" — if two tuples have the same X value, they must have the same Y value.

Example: Student_ID → Name, Branch, Marks

Armstrong's Axioms

AxiomRuleExample
ReflexivityIf Y ⊆ X, then X → Y{Name, Age} → {Name}
AugmentationIf X → Y, then XZ → YZA → B implies AC → BC
TransitivityIf X → Y and Y → Z, then X → ZSID→Branch, Branch→HOD ⟹ SID→HOD

Step-by-Step Normalization Example

🚫 Unnormalized (UNF) — Has Anomalies
SIDNameCoursesInstructorDept
101RahulDBMS, OSDr.A, Dr.BCSE
102PriyaDBMSDr.ACSE

❌ Problem: Multiple values in one cell (Courses, Instructor)

✅ 1NF — First Normal Form

Rule: All attributes must have atomic (single) values. No repeating groups.

SIDNameCourseInstructorDept
101RahulDBMSDr.ACSE
101RahulOSDr.BCSE
102PriyaDBMSDr.ACSE

PK = (SID, Course) | FDs: SID → Name, Dept | Course → Instructor

❌ Problem: Partial dependency — Name depends only on SID (part of key), not full key

✅ 2NF — Second Normal Form

Rule: 1NF + No partial dependencies (every non-key attribute must depend on the FULL primary key)

Student Table

SID (PK)NameDept
101RahulCSE
102PriyaCSE

Enrollment Table

SIDCourseInstructor
101DBMSDr.A
101OSDr.B
102DBMSDr.A

❌ Problem: Transitive dependency — Course → Instructor (if Instructor has other dependencies)

✅ 3NF — Third Normal Form

Rule: 2NF + No transitive dependencies (non-key attributes must depend ONLY on primary key, not on other non-key attributes)

✅ After removing all transitive FDs, we achieve 3NF.

✅ BCNF — Boyce-Codd Normal Form

Rule: For every functional dependency X → Y, X must be a super key. Stronger than 3NF.

Example: Students(SID, Course, Instructor)
FDs: (SID, Course) → Instructor | Instructor → Course
Problem: Instructor → Course, but Instructor is not a super key.
Solution: Decompose into: Teaching(Instructor, Course) and Enrollment(SID, Instructor)

Normalization Summary Table

Normal FormConditionEliminates
1NFAtomic values onlyRepeating groups, multi-valued cells
2NF1NF + no partial depsPartial functional dependency
3NF2NF + no transitive depsTransitive functional dependency
BCNFEvery determinant is a super keyAll anomalies (strongest)
🎙️ Viva Questions:
  1. What is normalization? Why is it needed?
  2. What is a functional dependency? Give an example.
  3. What is the difference between 2NF and 3NF?
  4. What is BCNF? How does it differ from 3NF?
  5. State Armstrong's axioms.
🗺️

ER to Relational Mapping

▾
ER ConceptRelational Mapping
Entity typeRelation (table) with same attributes
Simple attributeColumn in the table
Composite attributeOnly the sub-attributes (leaves) become columns
Multi-valued attributeNew separate table with FK reference
Derived attributeNot stored (computed when needed)
1:1 RelationshipAdd FK to either side; or merge into one table
1:N RelationshipAdd FK (PK of 1-side) to N-side table
M:N RelationshipCreate new junction table with both PKs as FKs
Weak entityTable with PK = owner's PK + partial key; FK to owner
🎙️ Viva Questions:
  1. How is a M:N relationship converted to relational tables?
  2. How is a multi-valued attribute mapped?
  3. How is a weak entity converted?

📝 Important Long Questions — Unit III

10 marks

Explain normalization in detail with examples showing 1NF, 2NF, 3NF, and BCNF step by step.

5 marks

Define functional dependency. State and explain Armstrong's axioms with examples.

5 marks

Explain relational algebra operations — selection, projection, union, intersection, and difference with examples.

10 marks

What is the relational model? Explain Codd's rules. Define tuple, attribute, domain, and degree with examples.

5 marks

Explain how an ER diagram is converted to relational tables. Show conversion for 1:N and M:N relationships.

Unit IV

🔐 Transactions, Security & NoSQL

🔄

Transaction Processing & ACID Properties

▾
Transaction: A sequence of database operations that must be executed as a single logical unit of work. Either ALL operations succeed, or NONE do.

Example: Bank transfer — deduct ₹5000 from Account A AND add ₹5000 to Account B. Both must happen or neither should happen.

Transaction States

Active
→
Partially Committed
→
Committed ✓

Active
→
Failed
→
Aborted / Rolled Back ✗

ACID Properties

A

Atomicity

All or nothing — either all operations in a transaction succeed, or none are applied.

Bank transfer: deduct AND credit must BOTH happen or neither.
C

Consistency

A transaction takes the database from one consistent state to another. All rules/constraints must hold before and after.

Total money in bank must remain same before and after transfer.
I

Isolation

Concurrent transactions execute independently — intermediate results are hidden from other transactions.

Two users booking the last seat can't both see it as available.
D

Durability

Once committed, changes are permanent even in case of system failure.

After booking confirmation, even if server crashes, booking persists.

Concurrency Problems

ProblemDescription
Dirty ReadT2 reads data written by T1 which hasn't committed yet
Unrepeatable ReadT2 reads same data twice, gets different values (T1 changed it in between)
Phantom ReadT2 executes same query twice, sees different rows (T1 inserted/deleted rows)
Lost UpdateT1 and T2 both update same data; T1's update is overwritten by T2

Recovery Techniques

TechniqueDescription
Log-based RecoveryMaintain a log of all changes; use REDO/UNDO operations
CheckpointPeriodically save state; recovery starts from last checkpoint
Shadow PagingKeep a shadow copy of database pages; switch on commit
Deferred UpdateWrite to log, apply changes only after COMMIT
Immediate UpdateApply changes immediately but log them for recovery
🎙️ Viva Questions:
  1. What are ACID properties? Explain with example.
  2. What is dirty read? How is it prevented?
  3. What is the difference between deferred and immediate update?
  4. What is a checkpoint in recovery?
🛡️

Database Security — Authentication & Authorization

▾
Authentication: Verifying the identity of a user — "Are you who you say you are?" (username/password, biometrics, OTP)
Authorization: Determining what an authenticated user is allowed to do — "What are you allowed to access?" (GRANT, REVOKE)
DCL — GRANT and REVOKE
-- Grant permissions to a user
GRANT SELECT, INSERT ON Students TO 'teacher_user'@'localhost';

-- Grant ALL privileges
GRANT ALL PRIVILEGES ON university.* TO 'admin'@'localhost';

-- Revoke permissions
REVOKE INSERT ON Students FROM 'teacher_user'@'localhost';

-- Grant with option to re-grant
GRANT SELECT ON Students TO 'dept_head' WITH GRANT OPTION;
Security LevelDescriptionExample
PhysicalSecure the physical serverLocked server room, CCTV
OS LevelOS-level access controlsUser accounts, file permissions
NetworkEncrypt data in transitSSL/TLS, firewalls, VPN
DBMS LevelSQL GRANT/REVOKE, rolesGRANT SELECT to 'user'
ApplicationApp-level checksLogin forms, session management
🍃

NoSQL Databases

▾
NoSQL stands for "Not Only SQL" — databases that provide flexible schemas and are designed for large-scale distributed data storage.
📄

Document Store

Stores data as JSON/BSON documents

MongoDB, CouchDB

{ "name": "Rahul",
  "branch": "CSE",
  "marks": 89 }
🗝️

Key-Value Store

Simple key → value pairs; extremely fast

Redis, DynamoDB

"user:101" → "Rahul"
"marks:101" → "89"
📊

Column-Family

Columns grouped into families; great for analytics

Cassandra, HBase

🕸️

Graph Database

Nodes and edges; great for relationships

Neo4j, Amazon Neptune

SQL vs NoSQL

FeatureSQL (RDBMS)NoSQL
SchemaFixed schemaFlexible/dynamic schema
ScalingVertical (bigger server)Horizontal (more servers)
ACIDFull ACID supportEventual consistency (mostly)
JoinsSupports complex joinsNo joins (embed or reference)
Use caseStructured, relational dataBig data, unstructured, real-time
ExamplesMySQL, Oracle, PostgreSQLMongoDB, Redis, Cassandra
🎙️ Viva Questions:
  1. What is NoSQL? How does it differ from SQL?
  2. What are the types of NoSQL databases?
  3. When would you prefer NoSQL over SQL?
  4. What is eventual consistency?

📝 Important Long Questions — Unit IV

10 marks

Explain ACID properties of transactions in detail with examples. What problems arise in concurrent transactions without ACID?

5 marks

What are recovery techniques in DBMS? Explain log-based recovery with checkpoint.

5 marks

Explain database security. What is the difference between authentication and authorization?

5 marks

What are NoSQL databases? Explain their types with examples. Compare SQL vs NoSQL.

🎙️ Complete Viva Question Bank

Unit I Viva

  1. What is DBMS? Advantages over file system?
  2. Explain 3-level DBMS architecture.
  3. What is data independence? Types?
  4. Difference between schema and instance?
  5. What is an entity? Entity type vs entity set?
  6. Types of attributes in ER model?
  7. What is a weak entity? Example?
  8. Super key vs candidate key vs primary key?
  9. What is a foreign key? Referential integrity?
  10. Specialization vs generalization?

Unit II Viva

  1. DDL vs DML — difference?
  2. DELETE vs TRUNCATE vs DROP?
  3. What is a view? Can you INSERT through a view?
  4. What is an index? Disadvantages?
  5. INNER JOIN vs LEFT JOIN?
  6. What is a trigger? Types?
  7. WHERE vs HAVING?
  8. What are aggregate functions?
  9. What is a stored procedure?
  10. Primary key vs unique constraint?

Unit III Viva

  1. What is normalization? Why needed?
  2. What is a functional dependency?
  3. State Armstrong's axioms.
  4. 1NF conditions?
  5. Partial dependency — what is it?
  6. Transitive dependency — what is it?
  7. Difference between 3NF and BCNF?
  8. What is a natural join?
  9. Relational algebra vs relational calculus?
  10. How to map M:N relationship?

Unit IV Viva

  1. What is a transaction?
  2. Explain each ACID property.
  3. What is a dirty read?
  4. What is deadlock in DBMS?
  5. Recovery techniques in DBMS?
  6. What is a checkpoint?
  7. Authentication vs Authorization?
  8. GRANT vs REVOKE?
  9. What is NoSQL? Types?
  10. When to use NoSQL over SQL?
Interactive

🃏 Flashcards

Click a card to reveal the answer. Great for last-minute revision!

0 / 0 reviewed
Practice

🎯 MCQ Quiz

Test your knowledge with timed multiple choice questions

Choose Your Quiz

One-Night Revision

⚡ Quick Revision Notes

Everything important, summarized. Perfect for the night before your exam.

🔑 Key Definitions

DBMS: Software to store, retrieve, and manage structured data
Relation: A table with rows (tuples) and columns (attributes)
Primary Key: Uniquely identifies a tuple; NOT NULL
Foreign Key: References primary key of another table
Normalization: Reducing redundancy & improving integrity
Transaction: A sequence of DB operations as one unit
ACID: Atomicity, Consistency, Isolation, Durability
View: Virtual table based on SELECT query
Trigger: Auto-executes SQL on INSERT/UPDATE/DELETE
Index: Data structure to speed up data retrieval

📊 Normal Forms — Quick Rules

1NF: Atomic values, no repeating groups
2NF: 1NF + No partial dependency on PK
3NF: 2NF + No transitive dependency
BCNF: For all X→Y, X must be a super key
Partial dep: Non-key attr depends on PART of composite PK
Transitive dep: A→B and B→C (B is non-key)
Lossless: No info lost during decomposition
Dependency preserving: All FDs maintained after decomposition

⌨️ SQL Quick Reference

DDL: CREATE, ALTER, DROP, TRUNCATE, RENAME
DML: SELECT, INSERT, UPDATE, DELETE
DCL: GRANT, REVOKE
TCL: COMMIT, ROLLBACK, SAVEPOINT
WHERE filters BEFORE grouping; HAVING AFTER
INNER JOIN: only matching rows both tables
LEFT JOIN: all left + matching right (NULL for unmatched)
COUNT(*) counts all rows; COUNT(col) skips NULLs
DISTINCT removes duplicates
NULL comparisons: use IS NULL, not = NULL

🔷 ER Model — Important Points

Entity: Rectangle | Attribute: Oval | Relationship: Diamond
Weak entity: Double rectangle
Derived attribute: Dashed oval
Multi-valued attribute: Double oval
Key attribute: Underlined name in oval
Super Key ⊇ Candidate Key ⊇ Primary Key
Specialization: top-down (VEHICLE → Car, Bus)
Generalization: bottom-up (Car, Bus → VEHICLE)
Cardinality: 1:1, 1:N, N:1, M:N

🔄 Relational Algebra Symbols

σ (Selection): Filter rows by condition
π (Projection): Select specific columns
∪ (Union): All rows from both (no duplicates)
∩ (Intersection): Rows in BOTH tables
− (Difference): In R but NOT in S
× (Cartesian Product): All combinations
⋈ (Natural Join): Join on common attributes
÷ (Division): Tuples in T related to ALL of S

🏆 Most Repeated Exam Questions

1. Explain ACID properties with bank transfer example
2. Normalize a given table to 1NF, 2NF, 3NF
3. Draw ER diagram for University/Library/Hospital
4. Write SQL queries with JOINs
5. Explain 3-tier DBMS architecture
6. Difference between super key and candidate key
7. Explain DROP vs DELETE vs TRUNCATE
8. What is BCNF? How does it differ from 3NF?
9. Explain joins with examples and output
10. NoSQL vs SQL comparison table