Data Management - Foundations

Data Management· 3 CUs· D426
Objective assessmentDue Mar 16, 2027
Lessons0 / 17
Databases, tables and SQL

Databases and database systems

12 min

Data is a set of recorded facts: a laptop serial number, a hire date, the status of a help desk ticket. A database is an organized collection of related data, stored so that people and programs can find it, change it and protect it. Information is data put in context so someone can act on it, for example: the help desk closed 312 tickets in March, 14 percent more than in February.

A database management system (DBMS) is the software that creates and runs databases. It stores the data on disk, answers requests, stops two users from overwriting each other, enforces rules, controls who can see what, and recovers after a crash. MySQL, PostgreSQL, Microsoft SQL Server, Oracle Database and SQLite are relational DBMSs. MongoDB and Redis are non-relational (NoSQL) systems. A database application is a program built on top of a database, such as a ticketing system or a payroll system.

Many teams start with a spreadsheet. That works for one person and a few thousand rows. It breaks down as soon as the data is shared and important.

NeedSpreadsheetDBMS
Many people editing at onceConflicting copies; the last save winsLocking and transactions keep every change consistent
Rules on the dataAnyone can type anything in any cellData types, keys and constraints reject bad data
SecurityWhoever has the file sees everythingEach user gets only the permissions granted
SizeExcel stops at 1,048,576 rows per sheetMillions or billions of rows, found quickly with indexes
RecoveryWhatever was last savedA log and backups restore a consistent state

People work with a database in different roles. The same person can hold more than one role in a small company.

RoleWhat the role doesHelp desk example
Database administrator (DBA)Secures the database, manages user accounts and permissions, runs backups, tunes performanceGrants the reporting team read-only access
Database designerDecides the structure: tables, columns, keys, relationships and rulesDesigns the Ticket and Device tables
Database programmerWrites programs and queries that read and change the dataBuilds the screen that opens a new ticket
Database userUses an application or simple queries to get work doneA technician who updates ticket status

Inside a DBMS, a few components share the work. You do not need to know how they are programmed, but you should know what each one is responsible for.

ComponentResponsibility
Query processorReads each SQL statement, checks its syntax and the user's permissions, and passes it to the optimizer, which picks the fastest way to run it (for example, use an index instead of reading the whole table)
Storage managerTurns the chosen plan into reads and writes of blocks on disk, using indexes to find rows
Transaction managerMakes sure each transaction finishes completely or not at all, keeps concurrent users from interfering, and restores a consistent state after a failure
LogA file that records every insert, update and delete, written before the change itself, so work can be redone or undone after a crash
Catalog (data dictionary)Metadata: data about the data, such as table names, columns, data types, keys, indexes and permissions

A transaction is a group of statements that must succeed or fail as one unit. Moving a laptop from one employee to another is a transaction: take it off the first employee's record and put it on the second. If the system stopped halfway, the laptop would belong to nobody. Transactions follow four rules, known as ACID.

PropertyMeaningExample
AtomicityAll statements in the transaction take effect, or none doBoth halves of the laptop transfer happen, or neither
ConsistencyA transaction moves the database from one valid state to another; every rule still holds afterwardNo device ends up assigned to an employee who does not exist
IsolationConcurrent transactions do not see each other's unfinished workA report running during the transfer sees the laptop in one place, never in two
DurabilityOnce committed, a change survives crashes and power lossAfter the commit, a reboot does not undo the transfer

ACID in plain words: all or nothing, rules still hold, work in private, done stays done.

Most business systems are relational: data lives in tables that are linked by keys and queried with SQL. NoSQL systems give up some of that structure in exchange for scale or flexibility, and they are common for very large, fast-changing or loosely structured data.

ModelStores data asProductsTypical use
RelationalTables of rows and columns linked by keysMySQL, PostgreSQL, SQL Server, OracleOrders, payroll, inventory, tickets
Key-valueA key and a value the database does not inspectRedis, Amazon DynamoDBCaching, user sessions, shopping carts
DocumentJSON-like documents that can differ from one anotherMongoDBProduct catalogs, content, user profiles
Wide-column (column family)Rows with flexible groups of columns spread across many serversApache CassandraVery large, write-heavy data such as logs and telemetry
GraphNodes and the edges that connect themNeo4jSocial networks, fraud rings, network maps

Big data is usually described by volume (how much), velocity (how fast it arrives) and variety (how many shapes it takes). A question that describes huge, fast, varied data, such as sensor feeds or website click streams, is pointing toward NoSQL or a distributed system, not a spreadsheet or a single small server.

ACID
Atomicity, consistency, isolation, durability: the guarantees a transaction provides.
Database
An organized collection of related data.
Database management system (DBMS)
Software that creates, runs, secures and recovers databases.
Metadata
Data that describes other data, such as column names and data types; stored in the catalog.
Transaction
A group of statements that must all succeed or all fail.

Knowledge check

Which DBMS component decides the most efficient way to run a query, such as using an index?

A server loses power halfway through a transaction that moves a device between two employees. After the restart, neither change is present. Which ACID property is at work?

Who would normally grant a reporting team read-only access and schedule nightly backups?