0
0
SQLquery~10 mins

Why views are needed in SQL - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a simple view that shows all employees.

SQL
CREATE VIEW employee_view AS SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
Aname
Bid
Csalary
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using a specific column name instead of selecting all columns.
Leaving the SELECT statement empty.
2fill in blank
medium

Complete the code to select only the name and salary columns from the view.

SQL
SELECT [1] FROM employee_view;
Drag options to blanks, or click blank then click option'
Aname, salary
Bid, department
Csalary, id
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting all columns (*) instead of specific ones.
Mixing up column names.
3fill in blank
hard

Fix the error in the view creation by completing the code correctly.

SQL
CREATE VIEW [1] AS SELECT id, name FROM employees;
Drag options to blanks, or click blank then click option'
Aview_employee
Bemployee_view
Cemployees_view
Demployee
Attempts:
3 left
💡 Hint
Common Mistakes
Using table names instead of view names.
Using ambiguous or unclear names.
4fill in blank
hard

Fill both blanks to create a view that shows only employees with salary greater than 50000.

SQL
CREATE VIEW [1] AS SELECT name, salary FROM employees WHERE salary [2] 50000;
Drag options to blanks, or click blank then click option'
Ahigh_salary_employees
B>
C<
Demployee_salaries
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong comparison operator.
Choosing unclear view names.
5fill in blank
hard

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.

SQL
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);
Drag options to blanks, or click blank then click option'
Adept_large_employees
BUPPER(name)
C>
DLOWER(name)
Attempts:
3 left
💡 Hint
Common Mistakes
Using LOWER instead of UPPER for name conversion.
Using wrong comparison operator in HAVING clause.
Choosing unclear or unrelated view names.