Search code examples
viewrelational-databasetuple-relational-calculusdomain-calculus

Views in relational calculus


I was wondering if we can somehow define a view in relational calculus to split complex queries onto several smaller ones? Or do we have to write big queries as a composite?


Solution

  • A view mechanism is outside the calculus.

    But any practical tool/notation could use view definition as well as query expression. It's easy enough to just use a name to denote the value denoted by a query, for use in other queries; you can think of that name as a programming language constant name or variable name. There's no point in talking about views outside the context of variables, which are themselves outside of the calculus, because the idea behind a view name is that each time you use it the value it denotes is based on the current values of the variables named in its defining expression. If the values for the names in the defining expression don't change then you don't need a view definition, you can use a constant definition or variable assignment.

    Ask your instructors whether you are permitted to name constants/variables/views to clarify your querying.