Database Management Systems
What the exam tests
Relational terminology, keys, data types, and simple SQL - mainly SELECT with WHERE, ORDER BY, aggregate functions and GROUP BY. Normalisation is usually asked as one-mark definitions.
Core concepts
- A table (relation) holds rows (records) and columns (fields). Each column has a single data type.
- Primary key: unique and not null, identifies a row. Candidate keys are all columns that could serve; one becomes primary and the rest become alternate keys. A foreign key references a primary key in another table and enforces referential integrity.
- SQL clauses are evaluated logically as FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY.
- Data types: CHAR/VARCHAR for text, INT, DECIMAL, DATE, BOOLEAN. NULL means unknown, not zero and not blank.
- Normalisation: 1NF removes repeating groups, 2NF removes partial dependence on part of a composite key, 3NF removes transitive dependence on non-key columns.
Worked example
Table student(roll, name, marks, city). Query: SELECT name, marks FROM student WHERE marks >= 60 ORDER BY marks DESC. FROM picks the table; WHERE filters rows before any grouping, so only students scoring 60 or more survive; SELECT keeps two columns; ORDER BY marks DESC puts the highest first. If the question instead asks for the average per city, you need GROUP BY city with AVG(marks), and any filter on the average must use HAVING, not WHERE.
Traps
- = NULL never matches anything; use IS NULL or IS NOT NULL.
- WHERE filters rows, HAVING filters groups.
- DELETE removes rows and can often be rolled back; DROP removes the table structure itself.
- A primary key cannot contain NULL, but a UNIQUE column can.