Database Management Systems and SQL
What is tested
Database Management Systems and SQL tests relational concepts, keys, integrity and simple SQL. Expect table definitions, row operations, SELECT queries with conditions, sorting and aggregates.
Core rules
- A relation is a table; a tuple is a row; an attribute is a column. A primary key uniquely identifies each row and cannot be NULL.
- A foreign key references a primary key in another table and enforces referential integrity.
- DDL defines structures: CREATE, ALTER, DROP. DML changes data: INSERT, UPDATE, DELETE. DQL retrieves: SELECT.
- SELECT clauses run logically as FROM → WHERE → GROUP BY → HAVING → ORDER BY → SELECT list. Use single quotes for text literals.
- Aggregate functions include COUNT, SUM, AVG, MIN, MAX. COUNT(*) counts rows; COUNT(column) ignores NULLs.
Worked example
Table Student(Roll PRIMARY KEY, Name, Marks). Query: SELECT Name FROM Student WHERE Marks >= 60 ORDER BY Marks DESC;. FROM Student chooses the table; WHERE Marks >= 60 filters rows before grouping; ORDER BY Marks DESC sorts the surviving rows by marks, highest first; the select list returns only Name. Roll is not selected because the question asks for names.
Traps
DELETE removes rows but keeps the table; DROP removes the table structure. WHERE filters rows; HAVING filters groups. NULL = NULL is not true; use IS NULL. Do not put numeric literals in quotes unnecessarily, and do not omit the FROM clause.