Back to questions

SQL GROUP BY Practice Exercise: Candidate Skills LinkedIn SQL Interview Question

SQL GROUP BY Practice Exercise: Candidate Skills

LinkedIn SQL Interview Question

This SQL GROUP BY exercise uses real data from a LinkedIn SQL Interview question which is a bit too hard to tackle right now, so we'll solve an easier variant of the interview question.

Suppose you are given a table of candidates and their skills. How many candidates possess each of the different skills? Sort your answers based on the count of candidates, from highest to lowest.

Assumption:

  • There are no duplicates in the table.

Table:

Column NameType
candidate_idinteger
skillvarchar

Example Input:

candidate_idskill
123Python
123Tableau
123PostgreSQL
234R
234PowerBI
234SQL Server
345Python
345Tableau

Example Output:

skillcount
Python4
Tableau4
PostgreSQL2
PowerBI1
R1
SQL Server1
Java1

Input

Output