DBMS

🔑 PART 1: KEYS IN DBMS (MOST SCORING)

🔹 What is a Key?

👉 A key is an attribute (or set of attributes) that uniquely identifies a record in a table.

🧠 Memory Trick:

“S C P F A” → Super, Candidate, Primary, Foreign, Alternate


🔹 Types of Keys (Exam Favorite)

KeyMeaningEasy Example
Super KeyCan uniquely identify recordRollNo, (RollNo + Name)
Candidate KeyMinimal Super KeyRollNo
Primary KeyChosen candidate keyRollNo
Alternate KeyCandidate key not chosenAadhaar
Foreign KeyRefers to PK of another tableDeptID
Composite KeyMore than one attribute(RollNo + Subject)

📌 MCQ Tip
✔ Every Primary Key is a Candidate Key
❌ Every Candidate Key is not Primary Key


🔥 One-Line Exam Facts

  • Primary key cannot be NULL

  • Foreign key can be NULL

  • One table → only one Primary Key

  • Multiple Candidate Keys possible

📐 PART 2: NORMALIZATION (VERY HIGH WEIGHTAGE)

🔹 What is Normalization?

👉 Process of removing redundancy and avoiding anomalies

🧠 Memory Line:

“N R A” → No Redundancy, Avoid Anomaly


🔹 Types of Anomalies (1 MCQ sure)

TypeMeaning
Insert AnomalyCannot insert data
Update AnomalyUpdate in many places
Delete AnomalyData loss

🔹 Normal Forms (ULTRA IMPORTANT)

✅ 1NF (First Normal Form)

✔ No multivalued attributes
✔ Atomic values only

{Maths, Science} → Wrong
Maths, Science → Correct


✅ 2NF

✔ Must be in 1NF
✔ No Partial Dependency

🧠 Trick:

Partial dependency occurs only when PK is composite


✅ 3NF (MOST ASKED)

✔ Must be in 2NF
✔ No Transitive Dependency

🧠 Trick:

Non-key → Non-key = Transitive (❌)


🔥 Normalization Summary (MEMORIZE)

NFRemoves
1NFMultivalued
2NFPartial dependency
3NFTransitive dependency

📌 Exam Fact:
👉 3NF is sufficient for most databases


🧮 PART 3: SQL (GUARANTEED MARKS)

🔹 SQL Categories (MCQ FAVORITE)

TypeCommands
DDLCREATE, DROP, ALTER
DMLINSERT, UPDATE, DELETE
DQLSELECT
DCLGRANT, REVOKE
TCLCOMMIT, ROLLBACK

🧠 Trick:

DDL–DML–DCL–TCL


🔹 Important SQL Commands

SELECT

SELECT * FROM Student;

WHERE

SELECT * FROM Student WHERE Marks > 60;

GROUP BY

👉 Used with aggregate functions

SELECT Dept, COUNT(*) FROM Student GROUP BY Dept;

HAVING

👉 Works after GROUP BY

SELECT Dept FROM Student GROUP BY Dept HAVING COUNT(*) > 5;

📌 MCQ Trap

  • ❌ WHERE with aggregate → Wrong

  • ✔ HAVING with aggregate → Correct


🔹 Aggregate Functions (VERY IMPORTANT)

FunctionMeaning
COUNT()Number
SUM()Total
AVG()Average
MAX()Maximum
MIN()Minimum

🔥 SQL JOIN (1–2 MCQ sure)

JoinMeaning
INNER JOINCommon records
LEFT JOINAll left + matched
RIGHT JOINAll right + matched
FULL JOINAll records

🧠 Trick:

LEFT → Left table full



🧩 PART 4: RELATIONAL ALGEBRA (CONCEPTUAL MCQs)

🔹 What is Relational Algebra?

👉 Procedural query language

👉 Uses operators



🔹 Important Operators (MUST REMEMBER)

SymbolOperator
σSelection
πProjection
Union
Set Difference
×Cartesian Product
Join

🔹 Examples (VERY SIMPLE)

Selection

σ Marks > 60 (Student)

Projection

π Name, Marks (Student)

📌 MCQ Tip

  • Selection → Rows

  • Projection → Columns


🎯 FINAL EXAM MEMORY SHEET (REVISE DAILY)

🔑 Keys

✔ Primary = Unique + Not Null
✔ Foreign = Reference

📐 Normalization

✔ 1NF → Atomic
✔ 2NF → No Partial
✔ 3NF → No Transitive

🧮 SQL

✔ WHERE ≠ HAVING
✔ GROUP BY → Aggregate

🧩 Relational Algebra

✔ σ → Rows
✔ π → Columns





 


 

Comments

Popular posts from this blog

SOFTWARE ENGINEERING

COMPUTER NETWORK

What does Decimal to Binary mean