Top 5 Highest Paid InternsEasy

Top 5 Highest Paid Interns

EasySQLPractice library · +10 XPsorting and limitssqlranking

UptoSkills Arena is helping a startup recruit interns. They need a list of the 5 highest-paid interns to consider for full-time roles.

Tables:

  • interns: intern_id (integer), name (varchar(50)), stipend (numeric(10,2))

Return the name and stipend of the 5 interns with the highest stipend, ordered by stipend in descending order. If there are ties in stipend, the order among tied interns does not matter. NULL stipends should not be considered. If fewer than 5 interns exist, return all of them.

Tables

CREATE TABLE interns ( intern_id integer PRIMARY KEY, name varchar(50) NOT NULL, stipend numeric(10,2) );

Example data

INSERT INTO interns (intern_id, name, stipend) VALUES
(1, 'Alice', 5000.00),
(2, 'Bob', 4500.00),
(3, 'Charlie', 5000.00),
(4, 'David', 6000.00),
(5, 'Eve', 4800.00),
(6, 'Frank', 5500.00),
(7, 'Grace', 4500.00);

Your query is also checked on hidden datasets with different data.

Hints