#4 is implemented: added sql that I forgot to commit in the previous commit for this issue.