


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Architecture Level Core Purpose & Responsibility Data Independence Provided
External Schema (View Level)
Tailors customized data views for specific end- user roles or applications while hiding sensitive or irrelevant columns.
Shielded from conceptual changes via Logical Data Independence.
Conceptual Schema (Logical Level)
Defines the logical structure of the entire database: entities, attributes, data types, relationships, and integrity constraints.
Shielded from storage changes via Physical Data Independence.
Internal Schema (Physical Level)
Describes low-level physical storage on disk: B+ tree indexes, hashing structures, block sizes, and compression.
Allows index/storage tuning without rewriting application queries.
Core Integrity Constraints
Operator Symbol Relational Algebra Definition & SQL Equivalent
Selection σp(R) Filters horizontal rows from relation R that satisfy predicate p (SQL: WHERE ).
Projection πA1,A2(R) Extracts vertical columns A 1 , A 2 and eliminates duplicate tuples (SQL: SELECT DISTINCT ).
Set Operations ∪ , ∩, − Union, Intersection, and Set Difference; requires both relations to be union-compatible (same arity and matching domains).
Cartesian Product R × S Pairs every tuple of R with every tuple of S (cardinality = |R| × |S|).
Natural Join R ⋈ S Combines tuples from R and S that share equal values on all common attribute names, removing duplicate columns.
4. Database Normalization (1NF to BCNF)
Normal Form Formal Requirement Anomaly Eliminated / Test Rule
1NF (First)
All column domains contain only atomic (indivisible) single values; no repeating groups or nested tables.
Eliminates multi-valued attributes and non-flat records.
(Second)
Must be in 1NF AND every non-prime attribute is fully functionally dependent on the entire primary key.
Eliminates partial dependencies (only applies when the primary key is composite).
3NF (Third)
Must be in 2NF AND for every non-trivial FD X → Y , either X is a super key OR Y is a prime attribute.
Eliminates transitive dependencies between non-key attributes (e.g., StudentID → Zip → City ).
BCNF (Boyce-Codd)
For every non-trivial functional dependency X → Y , X must be a super key (no prime-attribute exception).
Eliminates all redundancy caused by overlapping candidate keys.
High-Frequency Exam SQL Queries
-- 1. Find the Second Highest Salary (Subquery Pattern) SELECT MAX(salary) AS SecondHighestSalary FROM Employee WHERE salary < (SELECT MAX(salary) FROM Employee);
-- 2. Aggregation with GROUP BY and HAVING Filter SELECT department_id, COUNT(*) AS emp_count, AVG(salary) AS avg_salary FROM Employee GROUP BY department_id HAVING AVG(salary) > 60000;
7. Solved University Exam Practice Problem