While not exactly what you're looking for, The Definitive Guide to SQLite takes you from writing a SELECT statement all the way to an overview of SQLite internals. O'Reilly also published a booklet called Inside SQLite that goes a bit deeper into the subject. I suggest SQLite because the source code is superb (seriously, some of the most readable, most logically organized and best commented C code you'll ever see) and it's a fairly small codebase with a huge community.
And then there is Database Systems, The Complete Book where the second half of the book offers in deep coverage of the implementation of database systems.
This area is one where it look more impenetrable. You find good info about compilers and even build "computers" from scratch but databases is black magic.
Specially, because RDBMS look like are at all or nothing. I wonder if is possible to pick "only" the transactional/storage and made by myself the query/optimizer/api on top. I will be happy if is possible to build on top of something like sqlite, unfortunately, I don't know C at all (work with F#,C#, Delphi, Python).
In the other hand, know the basic steps could be good enough...
And then there is Database Systems, The Complete Book where the second half of the book offers in deep coverage of the implementation of database systems.