A database looks simple from the outside — you send a query, you get rows — and that simplicity is exactly what makes the internals hard to learn. Every layer, from the on-disk B-tree to the transaction log to the distributed replica set, is designed to preserve that illusion under load and failure. Read about them out of order and each concept seems to depend on the others.
The sequence that works starts at the storage engine, the concrete thing you can picture, then moves up through transactions and recovery, and finally out to distribution. Building understanding from the disk upward means each new abstraction rests on something you already grasp.
Start at the storage engine
Begin with Database Internals, a modern, approachable tour of how storage engines and distributed databases are actually built, from B-trees and LSM-trees to replication. Pair it with Designing Data-Intensive Applications, which places those internals in the wider context of why systems choose one storage model or consistency guarantee over another. Together they give you a working picture of what happens between the query and the disk.
Transactions and recovery
The heart of a database is keeping data correct through concurrency and crashes. Transaction Processing Concepts and Techniques is the monumental reference on transactions, logging, and recovery, written by pioneers of the field, and it repays slow reading. Concurrency control and recovery in database systems is the focused, rigorous treatment of exactly how isolation and durability are implemented. For the broader engine architecture around them, Database system implementation and Database management systems are the classic textbooks covering query processing, indexing, and optimization in depth.
The distributed frontier
Modern databases rarely live on one machine. Principles of distributed database systems is the comprehensive text on partitioning, distributed query processing, and replication, extending everything you have learned across nodes. To see how working systems make their trade-offs, Readings in database systems — the long-running "Red Book" — collects the seminal papers with editorial context, and it is the best way to understand why real databases are designed the way they are.
Read in this order and the black box opens up into a stack of comprehensible layers, each solving a concrete problem. Follow the full path to go from the storage engine to the design of a distributed database.