CS FundamentalsHardGATE CS · Product placement

Which view is generally updatable in standard SQL (an UPDATE through it maps to exactly one base row)?

  1. A. CREATE VIEW v AS SELECT dept, AVG(salary) FROM Emp GROUP BY dept
  2. B. CREATE VIEW v AS SELECT e.id, d.city FROM Emp e, Dept d WHERE e.dept = d.name
  3. C. CREATE VIEW v AS SELECT DISTINCT dept FROM Emp
  4. D. CREATE VIEW v AS SELECT id, name FROM Emp WHERE dept = 'IT'

Correct answer: D. CREATE VIEW v AS SELECT id, name FROM Emp WHERE dept = 'IT'

A view over one table with no DISTINCT, aggregation or grouping lets each view row map to a unique base row. Aggregates and DISTINCT collapse rows, and join views are generally not updatable.

More DBMS and SQL questions

Exams that ask this topic