[thelist] MySQL oddness

Matt Warden mwarden at gmail.com
Wed Jan 30 13:29:06 CST 2008

On 1/29/08, Phil Turmel <pturmel-webdev at turmel.org> wrote:
> > [1]
> > http://en.wikipedia.org/wiki/Projection_(relational_algebra)
> >
> Projection is merely an implementation of DISTINCT or GROUP BY.
> If your query doesn't call for it, you might get duplicate rows.
> If your query does call for it, which columns are involved
> affects the results.  If your application needs projection for
> correctness, you'd better be explicit.

Phil, I think there is some confusion here. You are correct that you
will get duplicates if you do not include a group operation, but that
is because the database is diverging from relational algebra
principles in that regard. A projection is indeed an operation that
takes a tuple (row) and re-orders and/or restricts the attributes
(columns) contained in the relation (table). It is an operation that
results from the *select* phrase in the SQL and NOT the group phrase.
I don't know the history behind the decision to diverge from
relational algebra in this manner, but I can assume that it was likely
a usability concern that has to do with end users being confused at
why cardinalities were changing just because they've selected
different columns.


Matt Warden
Cincinnati, OH, USA

This email proudly and graciously contributes to entropy.

More information about the thelist mailing list