Database Management (DBMS)
A database management system stores data in related tables and keeps it correct and safe. Exams ask keys, relational algebra, normal forms, SQL command groups and clauses, ACID transactions, E-R diagram symbols, views and indexes.
What should you know about Database Management (DBMS)?
- partial dependency of a non-key attribute on part of a composite key: 1NF: atomic values. 2NF: no partial dependency. 3NF: no transitive dependency. BCNF: every determinant is a candidate key.
- ascending: Add DESC for descending order; ASC is assumed when nothing is written.
- COUNT(column): COUNT(*) counts all rows; COUNT(column) skips NULLs; SUM, AVG, MIN and MAX also ignore NULLs.
- rectangle: Rectangle: entity; ellipse: attribute (double ellipse: multi-valued); diamond: relationship; double rectangle: weak entity.
Which formulas and rules are used in Database Management (DBMS)?
|R × S| = |R| × |S|; degree = deg R + deg S
e.g. Cartesian product
super keys = 2^(n − 1)
e.g. n attributes, one single-attribute candidate key
max |R ∪ S| = |R| + |S|
e.g. union-compatible relations
What are the shortcuts for Database Management (DBMS) questions?
- 1NF atomic, 2NF no partial dependency, 3NF no transitive dependency, BCNF every determinant a candidate key.
- DDL: CREATE ALTER DROP TRUNCATE; DML: SELECT INSERT UPDATE DELETE; DCL: GRANT REVOKE; TCL: COMMIT ROLLBACK.
- WHERE filters rows, HAVING filters groups.
- The three wrong options are always of the same kind as the answer (four Articles, four years, four names). Recall one firm fact about each option and strike out the ones you are sure of.
How do you solve Database Management (DBMS) questions? Worked examples
Example 1
A view in SQL is a:
Options: backup copy of a table; type of index; user account; virtual table defined by a stored query
Solution
A view shows the result of its query each time it is used; it can hide columns and simplify joins.
Answer: virtual table defined by a stored query
Example 2
In relational algebra, the SELECT (σ) operation picks:
Options: all pairs of rows from two tables; columns; rows that satisfy a condition; the union of two tables
Solution
σ selects rows; π (project) selects columns; × gives the Cartesian product; ⋈ joins on matching values.
Answer: rows that satisfy a condition
Example 3
R has 4 tuples and S has 3 tuples. How many tuples are in R × S?
Solution
- Each of the 4 tuples of R pairs with each of the 3 tuples of S.
- 4 × 3 = 12.
Answer: 12
What mistakes should you avoid in Database Management (DBMS)?
- Degree = columns, cardinality = rows; they are easy to swap.
- DELETE can be rolled back and takes WHERE; DROP removes the table itself.
- Read the question word carefully: NOT, FIRST, LAST, "correct" and "incorrect" turn the answer around.
Database Management (DBMS) question book: practice each sub-topic
- Database Management (DBMS)
Question book · 1 chapters
Database Management (DBMS)
A relation has 6 attributes, and its only candidate key is a single attribute A. How many super keys does it have?
Solution
A super key is A plus any subset of the other 5 attributes: 2^5= 32
Answer: 32
Open the book to turn the pages: every question with its answer and full solution.
Ready? Take a mock: fresh questions every time, each with a step-by-step solution.