Jump to content

DBMS/Query Languages

From Wikibooks, open books for an open world

Query Languages

[edit | edit source]
query
the retrieval of tuples from the relations of a relational schema
query language
a language used to retrieve information (tuples) from the relations of a relational schema.

types of query language

  • procedural language
  • non-procedural language

Mathematical query languages

  • Relational algebra
  • Tuple relational calculus
  • Domain relational calculus

Relational algebra

[edit | edit source]

relational algebra is a procedural query language

    • operations
      1. selection (r σ s) -
      2. projection (r ∏ s) -
      3. union: (r ∪ s)
      4. set difference: (r – s)
      5. Cartesian product: (r X s)
      6. rename: ( ρr )
      7. intersection:
      8. natural join:
      9. division:
      10. union:
      11. intersection:
      12. outer join

BY:NA

Tuple relational calculus

[edit | edit source]

A tuple variable is variable that takes on tuples of a particular relation schema as values. That is, every value assigned to a given tuple variable has the same number and type of fields. A tuple relation calculus query has the form {T I p(t)} where T is a tuple variable and p(T) denotes a formula that describes T; The result of this query is the set of all tuples t for which the formula p(T)evaluates to true with T=t.

Domain relational calculus

[edit | edit source]