Theory of Relational Databases