Converting a certain SQL query into relational algebra

Posted by Fumler on Stack Overflow See other posts from Stack Overflow or by Fumler
Published on 2012-09-15T15:29:30Z Indexed on 2012/09/15 15:37 UTC
Read the original article Hit count: 241

Filed under:
|
|
|
|

Just doing an assignment for my database course and I just want to double check that I've correctly wrapped my head around relational algebra.

The SQL query:

SELECT dato, SUM(pris*antall) AS total
FROM produkt, ordre
WHERE ordre.varenr = produkt.varenr
GROUP BY dato
HAVING total >= 10000

The relational algebra:

stotal >= 10000(
  ?R(dato, total)(
    sordre.varenr = produkt.varenr(
      datoISUM(pris*antall(produkt x ordre))))

Is this the correct way of doing it?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about sql