Same query, different result (depending on user’s permissions)

permissionssql-standard

A question about SQL in general:

If two users execute the same sql statement, is it possible that user1 gets different results than user2?

Imagine user1 has more permissions than user2.

With other words: Is it possible that user1 receives 100 rows, and user2 only 80?

My question is about the SQL standard.

But feel free to speak about implementations of specific DB systems in comments.

Best Answer

If two users execute the same sql statement, is it possible that user1 gets different results than user2?

Yes, absolutely.

Row-Level Access Control allows the Database Administrator to put "contextual" filters on a table so that different users really do see different data.

For example, a Users table might be protected such that users in the Personnel department can see everyone but anyone in any other department can only see people in the same department.