Core CS · DBMS
Numbers do not mean anything by themselves
Data is what you recorded. Information is what someone can act on. Everything a DBMS does lives in the gap between them.
Turn five raw marks into an answer →01 The idea
The gap between a value and a fact
Here are five numbers: 78, 65, 35, 82, 90. You cannot do anything with them. Not because they are wrong or incomplete, but because nothing has said what they count. They could be marks out of 100. They could be ages, or rupees, or the last five readings from a sensor. The numbers do not care and they will not tell you.
Now add one line: these are the marks five students scored in a DBMS mid-term, out of 100, and 40 is the pass mark. Not one digit changed. What changed is that questions became answerable. The class averaged 70. Nikhil topped with 90. Four of the five cleared the pass mark, so 80 per cent of the class passed, and Meera at 35 is the one who did not. The line you added is metadata, and everything after it is arithmetic.
This is also why “a database is a collection of related data” is the answer that gets a follow-up question. A folder of five spreadsheets is a collection of related data. What makes something a database is that the description of the data is stored inside it, next to the data, in a form the software itself can read. Ask a database what its columns are called and it answers. Ask a spreadsheet and you have to go and find the person who made it.
02 Worked example
One question, and the five layers under it
You type one line: SELECT student, marks FROM marks WHERE marks < 40;. Nothing in it names a file, a disk block or a byte offset. Follow the same five values from section 01 on their way to becoming an answer.
Those two rows hold the same bytes. Everything that happened between them happened in five layers, and only the first and the last are visible to you.
The highlighted node is the one students skip. Without the data dictionary the storage engine has a block of bytes and no way to cut it into fields, and the DBMS has a table name it cannot resolve. Metadata is not documentation sitting beside the database. It is a working part of every single read.
Take the middle three nodes away and you are back to a file plus a person who has to know its layout. That is how it was done before databases: the byte offsets lived inside every program that read the file, so the storage and the programs could never change independently. Moving that knowledge into the dictionary is what breaks the coupling, and it has a name. Physical data independence is the ability to change how data is stored without rewriting the code that reads it.
03 Mechanics
What the layer buys you, row by row
The interview version of this section is “file system versus DBMS”. Answer it as a list of properties, not a list of adjectives. Each row below is one thing that goes wrong with plain files and the named mechanism that fixes it.
| What you are relying on | A folder of files | A DBMS |
|---|---|---|
| Where the layout is written down | inside every program that reads it | once, in the data dictionary |
| Two people writing at the same time | last writer wins | transactions and locking |
| A crash halfway through a change | a half-written file | atomicity: all of it or none of it |
| Stopping a bad value getting in | whatever the writer remembered to check | types, NOT NULL, CHECK, foreign keys |
| Asking a question nobody planned for | write a program | write a query |
| Finding one row among a million | read the whole file | an index the planner chooses |
| Who may see which part | the whole file, per operating-system user | GRANT, per table and per role |
The first row is the one everything else rests on, so it is worth opening up. Here is what the dictionary records about a single column, marks.marks, and what stops working if that entry is missing.
| What is recorded | For marks.marks | What breaks without it |
|---|---|---|
| Column name | marks | You address the value by byte offset instead, in every program that reads it. |
| Type and width | SMALLINT, 2 bytes | The byte 4E is the number 78 and also the letter N. Nothing decides between them. |
| Position in the row | second | The storage engine has a block of bytes and no way to cut it into fields. |
| Nullability | NOT NULL | “Has not sat the exam yet” and “scored zero” become the same row. |
| Constraint | CHECK (marks BETWEEN 0 AND 100) | A typo of 350 is stored, and every average computed after it is wrong. |
| Privileges | teacher may UPDATE, student may SELECT | Anyone who can open the file can edit any mark in it. |
05 Cheat sheet
Say this, not that
Every term here has a short answer that is correct and a shorter one that is correct but hollow. The hollow one is not wrong, which is exactly why it invites the follow-up question in the third column.
| Term | Say this | The answer that invites a follow-up |
|---|---|---|
| Data | recorded values, no question attached | “numbers” — then a name or a date is not data, which you do not want to defend. |
| Information | data given context and processed to answer a question | “processed data” — true and empty. The next question is what processing, and context does half the work with none. |
| Database | an integrated, shared, self-describing store of data and its metadata | “a collection of related data” — so is a folder of spreadsheets, and that is the follow-up. |
| DBMS | the software that owns the files and answers queries about them | “software to manage a database” — circular. Name what it does: dictionary, constraints, transactions, recovery, access control. |
| Metadata | names, types, widths, nullability, constraints, owners, indexes | “data about data” — the follow-up is “such as?” and the list above is the whole answer. |
| Data dictionary | the DBMS’s own tables holding all of that metadata | “where the schema is kept” — vague. Name a real one you have queried. |
| Database system | the database, plus the DBMS, plus the applications and users on top | “same as a database” — then you cannot say which layer enforces a constraint. |
06 Where & why
Where the metadata actually lives
The data dictionary is not an abstraction from a textbook. It is a set of tables with names, in every database you have ever opened, and you can read them today. An answer that names one lands very differently from one that says “the metadata is stored somewhere in the system”.
PostgreSQL keeps its catalogs in the pg_catalog schema and exposes the standard view of them as information_schema. MySQL exposes information_schema too, and SHOW COLUMNS FROM marks is the shortcut. Same SELECT, same result grid, same permissions model as the data itself.
Oracle calls it the data dictionary outright: base tables owned by SYS, read through views such as USER_TAB_COLUMNS and ALL_TABLES. The USER_, ALL_ and DBA_ prefixes are themselves an access-control decision expressed in metadata.
sqlite_master holds one row per table, index, view and trigger, and its sql column stores the original CREATE statement text. The whole database, data and dictionary together, is a single file on disk. Self-describing does not require a server.
A column headed marks holding the value 35 has a heading and nothing else: no type, no constraint, no owner. The rule that marks run 0 to 100 exists only as the habit of whoever maintains the sheet, so nothing stops a typo of 350 and nothing records who typed it. Every argument for a DBMS starts here.
07 Interview questions
What they actually ask
This is the first question in most DBMS interviews and the one candidates most often answer from memory. The give-away is a definition that cannot survive one follow-up. Answer each of these in about twenty seconds, out loud.
What is the difference between data and information?
Give me something that is information to one system and data to another.
Why is “data is raw, information is processed” an incomplete answer?
What is a database?
So how is it actually different from a folder of files?
What is a DBMS, and what does it do while running one SELECT?
What is metadata? Name five kinds.
What is the data dictionary, and where is it in a database you have used?
Who writes to the data dictionary?
Database, DBMS, database system: are they the same thing?
When is a plain file the right answer instead of a database?
08 Practice problems
Six to work through
None of these has a single-word answer. For each one, write down what you know, what you assumed, and which of the two came out of the data rather than out of your head.