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

  1. Write relational algebra for names of students with marks above 60.
  2. Differentiate WHERE and HAVING.
  3. What is a left outer join?
  4. What is a trigger?
  5. State the three Armstrong axioms.

Long answer questions

  1. Explain relational algebra operations with examples.
  2. Explain all SQL joins with sample tables.
  3. Explain views, procedures, functions and cursors.
  4. Explain 1NF, 2NF, 3NF and BCNF with examples.
  5. 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