You can read about the awesome theory behind relational algebra. Gave me a great appreciation for how awesome SQL databases actually are (and why they work the way they do).
http://wwwlgis.informatik.uni-kl.de/archiv/wwwdvs.informatik...
https://github.com/postgres/postgres/tree/master/src/backend...
Sqlite is another good one to read, and play around with.
[0] https://www.amazon.com/Transaction-Processing-Concepts-Techn...
I also loved the MOOC by Prof. Jennifer Widom[1]
[0] http://pages.cs.wisc.edu/~anhai/courses/764-sp07-anhai/datam...