Converting a certain SQL query into relational algebra
- by Fumler
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?