Reputation: 9
Can an sql query ever return a different result than the relational algebra version?
Upvotes: 0
Views: 40
Reputation: 17528
Yes. For example, phenomena caused by interactions between insufficiently isolated transactions: e.g. dirty read, nonrepeatable read, and/or phantom read.
See http://www.postgresql.org/docs/9.3/static/transaction-iso.html
Upvotes: 1
Reputation: 781583
Yes. In relational algebra, duplicates are removed. SQL can return duplicate rows, you have to use SELECT DISTINCT
to force it to remove duplicates.
There are probably other cases, but this is the simplest example.
Upvotes: 1