Data Interview Qs - Finding the smallest salary difference

InterviewQs

Finding the smallest salary difference

SQL Database Querying Self-Join

Forward this email to a friend or colleague and challenge them to solve it.

Hi, 

You're given the following table showing employees at a company and their respective salaries:

Table: employee_salaries

employee_ID salary
1 80000
2 70000
3 67000
4 85000
5 95000
6 63000
7 58000
8 40000
9 55000

Given the above table, write a SQL query to return the employees with the closest absolute difference in salaries. If there is a tie (e.g. multiple employees have the same salary difference), then show the record with the lower sum of salaries.

You can view/query this table in an interactive SQL fiddle here.



 

You’ve accumulated 401 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.


Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Key phrases

Older messages

Simulating a population

Friday, January 20, 2023

Python, Statistics, Simulation, Normal Distribution, InterviewQs Simulating a population Python Statistics Simulation Normal Distribution Forward this email to a friend or colleague and challenge them

Snowiest months

Friday, January 20, 2023

Data Analysis, Python, Pandas, Data Manipulation, Data Visualization, External Dataset, InterviewQs Snowiest months Data Analysis Python Pandas Data Manipulation Data Visualization External Dataset

Average interview scores by interview outcome

Friday, January 20, 2023

SQL, Database Querying, Subquery, Case Statements, Join, InterviewQs Average interview scores by interview outcome SQL Database Querying Subquery Case Statements Join Forward this email to a friend or

Significant difference in time series dataset

Friday, January 20, 2023

Statistics, Significance Testing, Time Series, InterviewQs Significant difference in time series dataset Statistics Significance Testing Time Series Forward this email to a friend or colleague and

Coding a Fibonacci Sequence Function

Friday, January 20, 2023

Python, Algorithms, Data Structures, InterviewQs Coding a Fibonacci Sequence Function Python Algorithms Data Structures Forward this email to a friend or colleague and challenge them to solve it. Hi, A

You Might Also Like

Build5Nines - Local Generative AI, GitHub Copilot Chat, Azure Copilot

Wednesday, May 8, 2024

View this email in your browser Build5Nines - Cloud, DevOps & SRE Guidance Build5Nines Newsletter Your trusted source for Cloud, DevOps, and SRE guidance with Chris Pietschmann! Thank you for

FTX fraud victims are going to get their money back

Wednesday, May 8, 2024

Most of the company's customers will get their money back - plus interest View this email online in your browser By Alex Wilhelm Wednesday, May 8, 2024 Welcome to TechCrunch AM! Today we have notes

Who the 2024 iPad Pro is really for

Wednesday, May 8, 2024

Google Pixel 8a hands-on; Copilot prompt features; Best microSD cards -- ZDNET ZDNET Tech Today - US May 8, 2024 placeholder I've used every iPad since the original. Here's my buying advice for

DeveloPassion's Newsletter - Midweek Links #20

Wednesday, May 8, 2024

Edition Links #20 of my newsletter, discussing Knowledge Management, Knowledge Work, Zen Productivity, Personal Organization, and more! Sébastien Dubois DeveloPassion's Newsletter

Why you can't live (much longer) without digital BOMs

Wednesday, May 8, 2024

‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

How To Manage GenAI Security Risks

Wednesday, May 8, 2024

Managing GenAI Risks with SSPM Here to stay, GenAI tools are introducing new SaaS security risks. Employees often misplace their trust in easily accessible GenAI tools to automate work, without

Apple's new iPad Pro is thinner than an iPod nano

Wednesday, May 8, 2024

The Morning After It's Wednesday, May 08, 2024. We kicked off our Tuesday with an early iPad event. And what a beastly iPad we got. Apple shook things up by slotting its brand-new M4 chip into its

Hijack Loader Malware Employs Process Hollowing, UAC Bypass in Latest Version

Wednesday, May 8, 2024

THN Daily Updates Newsletter cover Webinar -- The Future of Threat Hunting Is Powered by Generative AI From Data to Defense: Step Into the Next Era of Cybersecurity with CensysGPT Download Now

Post from Syncfusion Blogs on 05/08/2024

Wednesday, May 8, 2024

New blogs from Syncfusion Visualize Customer Survey Reports Using React 3D Circular Charts [Webinar Show Notes] By Carter Harris This blog provides show notes for our May 2 webinar, “Visualize Customer

Apple unveils M4 chip 💻, TikTok sues US 🏛️, deniable encryption 🔒

Wednesday, May 8, 2024

Apple's Let Loose showcase was all about the iPad. The next iPad Pro will be powered by an M4 chip. It will use a new display tech called Tandem OLED Sign Up |Advertise|View Online TLDR Together