Complete the code to create a simple view that shows all employees.
CREATE VIEW employee_view AS SELECT [1] FROM employees;The * selects all columns from the employees table to include in the view.
Complete the code to select only the name and salary columns from the view.
SELECT [1] FROM employee_view;To get only the name and salary columns, list them separated by a comma.
Fix the error in the view creation by completing the code correctly.
CREATE VIEW [1] AS SELECT id, name FROM employees;The view name should be employee_view to follow naming conventions and clarity.
Fill both blanks to create a view that shows only employees with salary greater than 50000.
CREATE VIEW [1] AS SELECT name, salary FROM employees WHERE salary [2] 50000;
The view name high_salary_employees describes the content, and the operator > filters salaries greater than 50000.
Fill all three blanks to create a view that shows employee names in uppercase and their departments, only for departments with more than 10 employees.
CREATE VIEW [1] AS SELECT [2] AS name_upper, department FROM employees WHERE department IN (SELECT department FROM employees GROUP BY department HAVING COUNT(*) [3] 10);
The view name dept_large_employees fits the purpose. UPPER(name) converts names to uppercase. The operator > filters departments with more than 10 employees.