Complete the code to create a simple updatable view that selects all columns from the employees table.
CREATE VIEW employee_view AS SELECT * FROM [1];The view must select from the employees table to be relevant and updatable for employee data.
Complete the code to update the salary column in the updatable view for employee with id 101.
UPDATE employee_view SET salary = [1] WHERE employee_id = 101;
Salary is a numeric column, so the value must be a number without quotes.
Fix the error in the view definition to make it updatable by removing the aggregate function.
CREATE VIEW dept_salary AS SELECT department_id, [1] FROM employees;Aggregate functions like SUM, AVG, MAX make views non-updatable. Selecting the column directly allows updates.
Fill both blanks to create a view that is not updatable because it uses a join and a computed column.
CREATE VIEW [1] AS SELECT e.employee_id, e.name, d.department_name, e.salary * [2] AS adjusted_salary FROM employees e JOIN departments d ON e.department_id = d.department_id;
Views with joins and computed columns like salary * 1.1 are generally not updatable.
Fill all three blanks to create an updatable view that selects only specific columns and filters active employees.
CREATE VIEW [1] AS SELECT employee_id, [2], department_id FROM employees WHERE status = [3];
Filtering by status = 'active' and selecting columns without aggregates keeps the view updatable.