DBMS Flashcards: Keys, SQL & Normalization

Interactive flashcards to revise DBMS concepts for competitive exams. Click on a flashcard to reveal the answer and exam tips.

Part 1: Keys Hierarchy (PK, CK, SK, FK)

Flashcard 1: What is always a superkey?
Answer: Primary Key
Exam shortcut: PK = uniqueness + NOT NULL → always superkey
Flashcard 2: Can a foreign key be a candidate key?
Answer: Only if explicitly declared (rare). Usually NO
Exam trap: FK = reference, not uniqueness
Flashcard 3: Candidate key vs Superkey
Answer: Candidate key = minimal superkey; Superkey = any set that uniquely identifies tuples
Exam trick: Minimal = candidate, extra attributes = just superkey
Flashcard 4: Weak entity primary key
Answer: Partial key + owner entity PK
Exam trigger: Double rectangle → weak entity → composite PK
Flashcard 5: True/False: Every primary key is a candidate key
Answer: True
Exam shortcut: Primary key = chosen candidate key

Part 2: SQL Behavior

Flashcard 6: DELETE vs TRUNCATE
DELETE = row-by-row, can use WHERE, rollback possible
TRUNCATE = fast, removes all rows, cannot rollback
Flashcard 7: COUNT(*) with NULL comparison
Any comparison with NULL → UNKNOWN → COUNT(*) = 0
Use IS NULL / IS NOT NULL
Flashcard 8: GROUP BY vs SELECT vs WHERE
GROUP BY → aggregate rows
SELECT → choose columns (projection)
WHERE → filter rows (selection)
Flashcard 9: JOIN types
LEFT JOIN → all rows from left + matching from right
INNER JOIN → only matching rows
RIGHT JOIN → all from right + matching from left
FULL OUTER → all rows from both, matched where possible
Flashcard 10: Views
Views = virtual tables, always reflect latest base table data
Some views are updatable, most do not store data

Part 3: Normalization

Flashcard 11: 1NF → ?
Remove repeating groups
Flashcard 12: 2NF → ?
Remove partial dependency (non-key depends on part of composite PK)
Flashcard 13: 3NF → ?
Remove transitive dependency (non-key depends on non-key)
Flashcard 14: BCNF → ?
Every determinant is a candidate key
Exam trick: Stricter than 3NF, watch overlapping candidate keys
Flashcard 15: Partial vs Transitive Dependency
Partial → 2NF violation
Transitive → 3NF violation