Lowest and Highest Salary

EasySQLDatabaseSorting

Description

Write a SQL query to return the minimum salary as lo and the maximum salary as hi from the employees table. **Output columns (in order):** lo, hi

Table:employees
ColumnType
idINT
salaryINT

Examples

Input:CREATE TABLE employees (id INT, salary INT); INSERT INTO employees VALUES (1,30000),(2,90000),(3,50000);
Output:30000|90000
Explanation:

Taking the smallest and largest salary in one pass returns the pay range endpoints.

Input:CREATE TABLE employees (id INT, salary INT); INSERT INTO employees VALUES (1,42000);
Output:42000|42000
Explanation:

Taking the smallest and largest salary in one pass returns the pay range endpoints.

Input:CREATE TABLE employees (id INT, salary INT); INSERT INTO employees VALUES (1,100),(2,100),(3,100);
Output:100|100
Explanation:

Taking the smallest and largest salary in one pass returns the pay range endpoints.

Constraints

  • Use standard SQL (SQLite).

Ready to solve this problem?

Practice solo and sharpen your skills for technical interviews.