Hello,

I know relational algebra uses sets which eliminates duplicates values but I'm not sure about one thing.

Duplicate values are impossible to exist in a relation ever?
For example I can never have a relation R(A,B) with values (1,2),(1,2) ?

Or they get eliminated <b>after</b> a projection or selection, so when I do for example projA(R) <b>then</b> they get eliminated?

Thank you.

As far as I remember, in pure relational algebra, you quite simply cannot add an identical item to the set. So the set of colours {red, orange yellow, green, blue} cannot have a second colour red added at all.

In databases, you are relying on a primary key to prevent total duplicates, but you COULD end up with two entries R(A,B) as {1,red}, {2,red} if A was the primary key.

but you COULD end up with two entries R(A,B) as {1,red}, {2,red} if A was the primary key.

You're right, in that case when I do projB(R) I wont have any duplicates.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.