Most of the answers here are on the right track. However, a string is not a tuple . Tuples * are unordered sets of known values โโwith names. Thus, the following tuples are the same thing (I use the syntax of an imaginary tuple, since the relational tuple is largely a theoretical construct):
(x=1, y=2, z=3) (z=3, y=2, x=1) (y=2, z=3, x=1)
... assuming, of course, that x, y and z are integers. Also note that there is no such thing as a โduplicateโ tuple. Thus, not only the above are equal, they are one and the same. Finally, tuples can only contain known values โโ(thus, no zeros).
A row ** is an ordered set of known or unknown values โโwith names (although they may be omitted). Therefore, the following comparisons return false in SQL:
(1, 2, 3) = (3, 2, 1) (3, 1, 2) = (2, 1, 3)
Note that there are ways to "fake". For example, consider this INSERT :
INSERT INTO point VALUES (1, 2, 3)
Assuming x is the first, y is the second, and z is the third, this query can be rewritten as follows:
INSERT INTO point (x, y, z) VALUES (1, 2, 3)
Or that:
INSERT INTO point (y, z, x) VALUES (2, 3, 1)
... but all we really do is reorder, not delete it.
Also note that there may be unknown values. So you may have strings with unknown values:
(1, 2, NULL) = (1, 2, NULL)
... but note that this comparison will always be UNKNOWN . After all, how can you find out if two unknown values โโare equal?
And finally, rows can be duplicated. In other words, (1, 2) and (1, 2) can be compared as equal, but this does not necessarily mean that they are one and the same.
If this is a topic that interests you, I would highly recommend reading SQL and Relational Theory: how to write accurate SQL code from CJ Date.
* Please note that I am talking about tuples, as they exist in a relational model that is slightly different from mathematics in general.
** And just in case, when you are interested, almost everything in SQL is a row or a table. Therefore, (1, 2) is a row, and VALUES (1, 2) is a table (with one row).
UPDATE I expanded this answer a bit in the blog post here .