Interview Query

Repeat Job Postings

20
Have you seen this question before?

Given a table of job postings, write a query to retrieve the number of users that have posted each job only once and the number of users that have posted at least one job multiple times.

Each user has at least one job posting. Thus the sum of single_post and multiple_posts should equal the total number of distinct user_id’s.

Example:

Input:

job_postings table

Column Type
id INTEGER
job_id INTEGER
user_id INTEGER
date_posted DATETIME

Output:

Column Type
single_post INTEGER
multiple_posts INTEGER
Next question: Area Under the ROC Curve
.....
MySQL 8.0.17
Loading editor
Use Shift + Enter to run query