SQL and Relational Theory: How to Write Accurate SQL Code