Daniela
Daniela

Reputation: 491

Arithmetic division in relational algebra

I have an SQL request:

SELECT table1.nr1 / NULLIF(table2.nr2, 0) as percentage

and I want to write this in relational algebra.

Is it possible to represent arithmetic division in relational algebra?

Upvotes: 4

Views: 342

Answers (1)

Ortomala Lokni
Ortomala Lokni

Reputation: 62625

According to this course of the University of Rochester relational algebra can be defined as

a formal system for manipulating relations

  • Operands of this algebra are relations.
  • Operations of this algebra include the usual set operations (since relations are sets of tuples), and special operations defined for relations

    • selection

    • projection

    • join

It's an algebra on relations and there is no representation of numbers. If you want to use arithmetic on numbers you have to use an extended formalism such as Safe Database Queries with Arithmetic Relations.

Upvotes: 1

Related Questions