SQL
Lab
LinkedIn Easy Order By Limit

Most Common
Job
Title

Find the most frequently occurring job title.

Table Schema

Inspect
Table

interactive
ColumnTypeDescription
job_idintegerUnique job posting identifier.
company_idintegerIdentifier for the company posting the job.
titlestringJob listing title.
locationstringJob location.
salaryintegerListed salary.
posted_datedateDate the job was posted.
employment_typestringType of employment.

Sample Data

Input
Output

Sample Input: job_listings
job_idcompany_idtitlelocationsalaryposted_dateemployment_type
11AnalystNY600002024-01-01Full-time
22AnalystSF700002024-01-02Full-time
33EngineerTX900002024-01-03Contract
44AnalystCA800002024-01-04Full-time
55ManagerNY1000002024-01-05Full-time
66AnalystTX650002024-01-06Contract
Expected Output
titlecount
Analyst
4

SQL Editor

Run
Query

postgresql
Waiting for query

titlecount
Analyst
4

Hints

Unlock
Clues

Hint 01: Group by title.
Hint 02: Use COUNT(*) AS count.
Hint 03: Order by count DESC and LIMIT 1.

Solution

Locked
Answer

Solution is locked until you decide to reveal it. Try the editor first, then open this when you want the reference answer.

SELECT
  title,
  COUNT(*) AS count
FROM job_listings
GROUP BY title
ORDER BY count DESC
LIMIT 1;

Explanation

Step By
Step

01

Group the table by title.

02

Count how many rows each title has.

03

Sort descending and keep the first row.

Related Questions

Keep
Solving