Complete the code to create a view that only shows employees from the 'Sales' department.
CREATE VIEW sales_employees AS SELECT * FROM employees WHERE department = [1];The view filters employees to only those in the 'Sales' department by using the WHERE clause with 'Sales'.
Complete the code to add WITH CHECK OPTION to the view to prevent inserts or updates outside 'Sales'.
CREATE VIEW sales_employees AS SELECT * FROM employees WHERE department = 'Sales' [1];
WITH CHECK OPTION ensures that any insert or update through the view must satisfy the view's WHERE condition.
Fix the error in the view creation by choosing the correct placement of WITH CHECK OPTION.
CREATE VIEW sales_employees AS SELECT * FROM employees WHERE department = 'Sales' [1] WITH CHECK OPTION;
WITH CHECK OPTION must come at the end of the CREATE VIEW statement, not before or after the SELECT clause.
Fill both blanks to create a view that shows only active products and enforces this with CHECK OPTION.
CREATE VIEW active_products AS SELECT * FROM products WHERE status = [1] [2];
The view filters products with status 'active' and uses WITH CHECK OPTION to prevent changes that violate this condition.
Fill all three blanks to create a view for employees in 'HR' department with salary over 50000 and enforce it with CHECK OPTION.
CREATE VIEW hr_high_salary AS SELECT * FROM employees WHERE department = [1] AND salary > [2] [3];
The view filters employees in 'HR' with salary over 50000 and uses WITH CHECK OPTION to enforce this on inserts and updates.