Lecture notes from Stanford professor Jennifer Widom's online mini-courses about relational algebra and SQL.
The notes were made in Jupyter running a Python 2 kernel with SQL magic. Code cells view can be turned on/off as desired, thanks to this javascript snippet. Table of contents were created for the rather long SQL notes document with kmahelona's script. (Neither work in GitHub's online ipynb-viewer.)
The lecture notes are available in ipython notebook format and in HTML. To view the HTML version of the document, the simplest is probably to paste the url of the Jnotebooks into http://nbviewer.jupyter.org/, or you could download the zipped folder and view it in your desired browser locally.