Complete the code to create a simple updatable view showing employee names and salaries.
CREATE VIEW employee_salaries AS SELECT name, [1] FROM employees;The view should select the salary column to show employee salaries.
Complete the code to update the salary of an employee through the view.
UPDATE employee_salaries SET [1] = 60000 WHERE name = 'Alice';
To update the salary, set the salary column in the view.
Fix the error in the view definition to make it updatable by adding the clause that enforces the WHERE condition.
CREATE VIEW employee_info AS SELECT name, salary FROM employees WHERE department = 'Sales' [1];
The WITH CHECK OPTION ensures updates through the view meet the view's conditions, making it updatable.
Fill both blanks to create an updatable view that includes the employee ID and enforces updates only for the HR department.
CREATE VIEW hr_employees AS SELECT [1], name, salary FROM employees WHERE department = [2] WITH CHECK OPTION;
The employee id is needed for updates, and the filter must be for the 'HR' department.
Fill all three blanks to create an updatable view that shows employee ID, name, and salary, and only allows updates for employees with salary greater than 50000.
CREATE VIEW high_earners AS SELECT [1], [2], [3] FROM employees WHERE salary > 50000 WITH CHECK OPTION;
The view must include id, name, and salary columns to be updatable and show the correct data.