Create a High Earners View
Easysql
Learn the Concept: Simple ViewsWrite a CREATE VIEW statement named high_earners that exposes id, name, salary for every employee earning more than 80000. The checker will query your view afterward.
sqlCREATE TABLE employees ( id INTEGER PRIMARY KEY, name TEXT NOT NULL, department TEXT NOT NULL, salary INTEGER NOT NULL );
Sample data:
sqlINSERT INTO employees (id, name, department, salary) VALUES (1, 'Asha', 'Engineering', 90000), (2, 'Rohan', 'Engineering', 60000), (3, 'Neha', 'Sales', 70000), (4, 'Vikram', 'Sales', 50000);
Example 1
Input
(none)
Output
id name salary 1 Asha 90000
A simple view stores a query definition over a single table with no joins/aggregation. Reference: CREATE VIEW high_earners AS SELECT id, name, salary FROM employees WHERE salary > 80000;
Related Problems
- Engineering Team by SalaryEasy · sqlSolve Problem
- Employees Without a ManagerEasy · sqlSolve Problem
- Duplicate EmailsEasy · sqlSolve Problem