Databases (SQL)Final exam8 topics

Databases (SQL) final exam study sheet

A databases final almost always includes writing SQL by hand against a small schema, with no database to run it on. The midterm in many courses covers the relational model, ER diagrams, and basic queries. The final adds the harder query patterns plus design and systems topics such as normalization, indexing, and transactions, and how much of each depends heavily on the course.

It goes by a crib sheet, an aid sheet, or simply revision notes depending on the country; for this course it is mostly query templates and the normal-form rules.

Preview of the SQL reference sheet Cheat sheet locked
the reference sheet for this exam

The scope

What this exam usually covers

These are the problem types a database final often grades. Courses differ more than usual here, so check each one against your syllabus.

  • Joins Inner versus left outer join, and what happens to rows with no match. Points are lost by filtering the outer table's NULLs in WHERE, which quietly turns a LEFT JOIN back into an inner join.
  • GROUP BY and HAVING Every selected column must be grouped or aggregated. WHERE filters rows before grouping and HAVING filters groups after, and COUNT(*) versus COUNT(col) differ when the column has NULLs.
  • Subqueries IN, EXISTS, and correlated subqueries, plus the 'find X with no Y' and 'find the max per group' patterns. NOT IN against a subquery that returns a NULL yields no rows, a common trick question.
  • Keys and constraints Primary, foreign, and candidate keys, NOT NULL, UNIQUE, and ON DELETE behaviour. Writing CREATE TABLE with the right foreign key is a standard short question.
  • Normalization Find functional dependencies and candidate keys, then decide whether a table is in 2NF, 3NF, or BCNF and decompose it. Computing an attribute closure correctly is where most marks are won or lost.
  • Indexes and query cost When an index helps (selective WHERE, join columns) and when it does not, and the B+ tree as the usual index structure. Some courses ask for I/O cost estimates of joins or scans.
  • Transactions ACID, what a dirty read, non-repeatable read, and lost update are, and which isolation level prevents each. Some courses add two-phase locking and conflict serializability.
  • Relational algebra and ER Translate between SQL and selection, projection, and join, and map an ER diagram to tables. These often appear on the final even if they were mainly midterm material.

Usually later

Window functions, recovery and logging, query optimization internals, and NoSQL are taught in some database courses and not in others. ER modelling and relational algebra are often weighted toward the midterm, and the library SQL sheet does not cover them, so add them from your own notes. Check the review sheet for what the final emphasizes.

The rules

What a note sheet is usually allowed to include

check your exam header — it wins

Database finals vary widely. Some allow one page of notes, often handwritten, and many students fill it with query templates and the normalization steps. Others are closed-notes but print the schema on the exam, and a few provide a syntax reference. Some courses run part of the exam on a computer with a live database. In Canada this may be an aid sheet; in the UK, a crib sheet. The syllabus decides. This page is a study sheet either way: writing queries from memory before the exam is the best preparation for writing them on paper.

The sheet

The matching library sheet

A one-page reference for the whole topic, fact-checked, with the first part free to read. This exam page does not repeat it. Use it to see the material, then make a shorter study sheet from the notes your section actually used.

Make your own for this exam

Upload the lecture slides, the SQL homework, and any practice exam for the weeks the final covers. In the focus step, name what the review session stressed, for example correlated subqueries or BCNF decomposition. Pick one page, front and back, or an index card to match what your course allows.

Make this from your notes

FAQ

Questions

What should go on a databases crib sheet?
The clause order of a SELECT and the order it runs in, join templates including the anti-join pattern, GROUP BY and HAVING rules, how NULL behaves in comparisons and aggregates, the closure algorithm and normal-form tests, and the isolation-level table.
Can I bring a crib sheet to a databases final?
Only if your course allows one. One handwritten page is common in database courses, but some finals are closed-notes and print the schema instead. Check the syllabus or ask the instructor.
Why does my SQL look right but give the wrong answer?
The usual causes are a WHERE condition on the outer table of a LEFT JOIN, NOT IN against a subquery that returns NULL, a missing GROUP BY column, and joining on the wrong key so rows multiply.
How is this different from the SQL library sheet?
The library sheet is a SQL reference covering queries, joins, subqueries, DML, DDL, indexes, windows, and normalization. This page covers what a databases final usually grades, including design topics, and how to build a sheet from your own course notes.