Table Emp(id, salary) has rows (1,3000), (2,5000), (3,4000). CREATE VIEW HighPaid AS SELECT * FROM Emp WHERE salary > 4000; UPDATE Emp SET salary = 4500 WHERE id = 1; SELECT COUNT(*) FROM HighPaid; What does the final SELECT return?
Correct answer C. 2
Explanation
An ordinary view stores only its defining query, not a copy of the data. Every time HighPaid is queried, the SELECT runs against the current contents of Emp. After the update, salaries 4500 and 5000 exceed 4000, so the count is 2. The answer 1 assumes the view captured a snapshot when it was created, which describes a materialised view, not a standard view.
Answer checked How we write and check questions
Discussion