-
Notifications
You must be signed in to change notification settings - Fork 0
/
Duplicate Job Listings [Linkedin SQL Interview Question]
35 lines (27 loc) · 1.67 KB
/
Duplicate Job Listings [Linkedin SQL Interview Question]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
with cte as (select company_id, title, description,count(job_id) as job_count
from job_listings
group by company_id, title, description)
Select count(DISTINCT company_id) as duplicate_companies
from cte
where job_count>1;
----------------
This is the same question as problem #8 in the SQL Chapter of Ace the Data Science Interview!
Assume you're given a table containing job postings from various companies on the LinkedIn platform. Write a query to retrieve the count of companies that have posted duplicate job listings.
Definition:
Duplicate job listings are defined as two job listings within the same company that share identical titles and descriptions.
job_listings Table:
Column Name Type
job_id integer
company_id integer
title string
description string
job_listings Example Input:
job_id company_id title description
248 827 Business Analyst Business analyst evaluates past and current business data with the primary goal of improving decision-making processes within organizations.
149 845 Business Analyst Business analyst evaluates past and current business data with the primary goal of improving decision-making processes within organizations.
945 345 Data Analyst Data analyst reviews data to identify key insights into a business's customers and ways the data can be used to solve problems.
164 345 Data Analyst Data analyst reviews data to identify key insights into a business's customers and ways the data can be used to solve problems.
172 244 Data Engineer Data engineer works in a variety of settings to build systems that collect, manage, and convert raw data into usable information for data scientists and business analysts to interpret.
Example Output:
duplicate_companies
1