I'm stuck with relational algebra.
I mean, how can I express functions like "SUM(), COUNT()," etc in RA?
Thanks, any help will be kindly appreciated
I'm stuck with relational algebra.
I mean, how can I express functions like "SUM(), COUNT()," etc in RA?
Thanks, any help will be kindly appreciated
To start, you simply have to know that SUM
and COUNT
are called aggregate functions
. Then, just google "relational algebra for aggregate functions".
I don't know how to subscript/superscript on Stack Overflow, but this wikipedia entry has an example at the end of the paragraph. (You'll see GMax(Balance)(Account)
.)
Also promising: go to this link, and search the page for "Aggregate"... you'll see Fsum(salary)(E)
with subscripts.
something like this?
what cannot you understand? be more specific please.
You can find more details in your DBMS documentation
Or visit the wiki
Basically aggregate functions will make some kind of "cumulative" operation over a set of rows and usidng one column to (SUM, AVERAGE, etc) based on one or more "key" columns.
Example: You have a dataset containing demographic data from all cities of the nation, it happens to have a population count and a region identity column. You can use it to create a report of total population by region.