database - The Relational Model & Queries That Naturally Return Duplicate Rows -


it's commonly understood in relational model:

  1. every relational operation should yield relation.
  2. relations, being sets, cannot contain duplicate rows.

imagine 'users' relation contains following data.

id first_name last_name  1 mark       stone  2 jane       stone  3 michael    stone 

if runs query select last_name users, typical database return:

last_name stone stone stone 

since not relation - because contains duplicate rows - should ideal rdbms return?

"but information lost - there 3 users last name."

if count of users name interested in, query of example not question should asking.

the query of example provide answer question "what last names such there exists user has last name ?".

if question want ask "how many users there named 'stone'", query should submit select count(...) users last_name = 'stone';

projection always "looses" information. information tied attributes projected away. don't see how known property of useful relational operator can explained argument against operator.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -