Database Fundamentals
Cheat sheet · https://pcornel.dk/topic.php?topic=6085
Answer
A database stores structured data and serves it to applications through queries, guaranteeing consistency with transactions. Relational databases (PostgreSQL, MariaDB/MySQL, SQL Server) use tables, keys and SQL.
Remember
Separate the layers: network and authentication, the SQL itself, locks/transactions, server resources, and storage. Always know which engine and version you are on — syntax and tools differ.
First checks
SELECT version();— first check for this topicpsql -c "SELECT now(), version();"— PostgreSQL reachable and versionmysql -e "SELECT NOW(), VERSION();"— MariaDB/MySQL reachable and versionsqlcmd -S <server> -Q "SELECT @@VERSION"— SQL Server reachable and version
Verify in this order
application → connection (network, auth) → SQL → planner → storage engine → result
Where it usually breaks
Typical mistakes are mixing server/instance/database terminology, assuming ACID eliminates application-level race conditions, treating TCP reachability as a successful database session, or blaming storage before checking locks, sessions and engine state.
Database Fundamentals verification boundary matrix
| Boundary | Inspect | Healthy interpretation | Do not infer |
|---|---|---|---|
| Intent | Relational model | Intended object/scope is explicit and versioned where relevant | Intent is already effective |
| Owning runtime/control plane | Server → instance → database → schema → table boundaries / Rows, columns and keys | Owner accepts and reports the expected object state | Downstream dependencies are healthy |
| Effective state | ACID | Independent read-back matches the intended state | Every client sees the same result |
| Consumer outcome | Connections and sessions | The original bounded check succeeds in the same time window | Production correctness outside this scope |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6085