How does sql server system check duplicates? : I definitely know how to check duplicates/remove duplicates using sql server queries. But I am asking a deeper question about the system. How does the system handle duplicates? For example, how does the system remove duplicates from UNION ALL to UNION? I am guessing if the system is using hash code to do so? The employer said the process has something to do with ROWID. But even if two rows are exactly the same, their ROWID should be different, correct? How is that possible?