I am currently studying for a final and have a question about one of the practice problems.
The problem states:
Consider the following two SQL queries over the relation
R(A,B) where attribute
A is the primary key.
SELECT * FROM R WHERE B > 50 OR B <= 50
SELECT * FROM R WHERE A > 50 OR A <= 50
Which is correct?
a. Queries 1 and 2 return all the records in
b. Query 2 returns all the records in
R, but Query 1 may not
The official answer says that b is correct, but I wanted to know why. I understand that a primary key must be unique, meaning Query 2 should return every record. But wouldn't query 1 also return every record even if there were duplicate