← All Exercises

SQL SELECT with WHERE

basicsql~10min

Background

The SELECT statement with WHERE clause is the fundamental SQL operation for filtering table rows by conditions.

Problem

Write a SQL query to select all employees with a salary greater than 50000 from the employees table.

Input

An employees table with columns: id, name, department, salary.

Output

All columns for employees with salary > 50000, ordered by salary descending.

Sample tests

Sample 1

Input: employees table with 5 rows, 3 earning >50000
Expected: 3 rows with highest salary first

Your solution

Learning objective

Learn SELECT, WHERE, ORDER BY, and comparison operators in SQL.