If you prefer Java to C, I recommend taking a look at the source for H2, a pure Java SQL database engine. It is surprisingly easy to follow.
I've contributed to the H2 source code a few times, and in the process I got to learn much about how a database engine is implemented.
H2 home: http://www.h2database.com/
H2 Github repo: https://github.com/h2database/h2database