Employees With High Salary

Easy

Description

Write a SQL query to find all employees with a salary greater than 55000. Return name and salary columns, ordered by salary descending. **Output columns (in order):** name, salary

Table:employees
ColumnType
idINT
nameTEXT
salaryINT

Examples

Input:CREATE TABLE employees (id INT, name TEXT, salary INT); INSERT INTO employees VALUES (1, 'Alice', 50000), (2, 'Bob', 60000), (3, 'Charlie', 55000);
Output:Bob|60000
Explanation:

Alice has salary 50000, Bob has 60000, Charlie has 55000. Only Bob's salary (60000) is > 55000, so only Bob is returned.

Input:CREATE TABLE employees (id INT, name TEXT, salary INT); INSERT INTO employees VALUES (1, 'Alice', 45000), (2, 'David', 72000), (3, 'Emma', 58000), (4, 'Frank', 52000);
Output:David|72000 Emma|58000
Explanation:

David has salary 72000 > 55000 and Emma has salary 58000 > 55000. Alice (45000) and Frank (52000) are excluded as their salaries are ≤ 55000. Results are ordered by salary descending.

Input:CREATE TABLE employees (id INT, name TEXT, salary INT); INSERT INTO employees VALUES (1, 'John', 85000), (2, 'Mary', 48000), (3, 'Steve', 67000), (4, 'Lisa', 56000), (5, 'Tom', 55000);
Output:John|85000 Steve|67000 Lisa|56000
Explanation:

John (85000), Steve (67000), and Lisa (56000) all have salaries > 55000. Mary (48000) and Tom (55000) are excluded as their salaries are ≤ 55000. Results are ordered by salary descending.

Constraints

  • Use WHERE clause

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!