Unit summary
Relational algebra (selection, projection, union, difference, Cartesian product, join, division) is the theory behind SQL; relational calculus states what is wanted. SQL has DDL (CREATE, ALTER, DROP, TRUNCATE) and DML (INSERT, SELECT, UPDATE, DELETE), aggregates, predicates, GROUP BY, HAVING and ORDER BY. Joins combine tables (inner, left, right, full outer, equi, natural). Advanced SQL covers views, procedures, functions, cursors, triggers and recursive queries. Normalization uses functional dependencies and Armstrong's axioms to reach 1NF, 2NF, 3NF and BCNF.
Glossary
| Term | Meaning |
|---|---|
| Selection | Operation that picks rows by a condition |
| Projection | Operation that picks columns |
| Join | Combines rows of two tables on a condition |
| DDL | Commands that define structure |
| DML | Commands that read and change data |
| View | A saved query used like a table |
| Trigger | Code that runs automatically on an event |
| Functional dependency | X determines Y |
| Closure | All attributes determined by a set |
| BCNF | Every determinant is a super key |
Question bank
Short answer questions
- Write relational algebra for names of students with marks above 60.
- Differentiate WHERE and HAVING.
- What is a left outer join?
- What is a trigger?
- State the three Armstrong axioms.
Long answer questions
- Explain relational algebra operations with examples.
- Explain all SQL joins with sample tables.
- Explain views, procedures, functions and cursors.
- Explain 1NF, 2NF, 3NF and BCNF with examples.
- Find the closure of an attribute set and the candidate keys of a given relation.
Sources
- Official BCA syllabus Database Management Systems, course code CC202, Unit II
