Relational algebra and SQL code