Data Interview Qs - Employee salary increase with promotion

InterviewQs

Employee salary increase with promotion

SQL Database Querying Window Function Lead Function

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

Hi, 

You are given the following table containing historical employee salaries for company XYZ:

Table: EmployeeSalaries

employee_ID salary promoted year
1 80000 y 2020
1 70000 n 2019
1 65000 n 2018
2 65000 n 2020
2 65000 y 2019
2 60000 n 2018
3 61000 n 2019
3 60000 y 2018
3 55000 n 2018

Given the above table, write a SQL query to return the average percent that an employee's salary increased from the prior year when they are promoted.

For example, employee_ID 1 had a promotion in 2020 and their pay increased from 70,000 in 2019 to 80,000 in 2020, or a 14.2% increase from their prior salary. You will need to do this calculation across every record where promoted = 'y' and return the average of the results.

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



 

You’ve accumulated 313 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

Simple trading simulation

Wednesday, June 29, 2022

Python, Data Structures, Arrays, Algorithms, Simulation, InterviewQs Simple trading simulation Python Data Structures Arrays Algorithms Simulation Forward this email to a friend or colleague and

Valid board configurations

Monday, June 27, 2022

Python, Data Structures, Arrays, Algorithms, InterviewQs Valid board configurations Python Data Structures Arrays Algorithms Forward this email to a friend or colleague and challenge them to solve it.

Rejection reasons from binary classification model

Friday, June 24, 2022

Binary Classification, Statistics, Probability Distribution, Machine Learning, InterviewQs Rejection reasons from binary classification model Binary Classification Statistics Probability Distribution

Closest class scores

Wednesday, June 22, 2022

SQL, Database Querying, Cross Join, InterviewQs Closest class scores SQL Database Querying Cross Join Forward this email to a friend or colleague and challenge them to solve it. Hi, Suppose you are

Surveying class cheaters

Monday, June 20, 2022

Python, Bayes' Theorem, Binomial Distribution, Algorithms, PyMC3, InterviewQs Surveying class cheaters Python Bayes' Theorem Binomial Distribution Algorithms PyMC3 Forward this email to a

You Might Also Like

a16z’s Infrastructure team gets a new general partner

Friday, April 19, 2024

Post News is shutting down and Wall Street isn't feeling a Salesforce-Informatica pairing View this email online in your browser By Christine Hall Friday, April 19, 2024 Image Credits: Andreessen

New Roundtable! Additive for Mass Production Applications

Friday, April 19, 2024

The Outlook for the Future View this email in your browser engineering.com Roundtable - Additive for Mass Production Applications: The Outlook for the Future 6 Considerations for Choosing the Right

📷 What to Know About Macro Photography — Why You Should Buy a Budget Motherboard

Friday, April 19, 2024

Also: How to Automatically Highlight Values in Excel, and More! How-To Geek Logo April 19, 2024 📩 Get expert reviews, the hottest deals, how-to's, breaking news, and more delivered directly to your

Is the wind going out of the AI sails?

Friday, April 19, 2024

Rippling vacuums up venture capital and Ramp bags more millions View this email online in your browser By Haje Jan Kamps Friday, April 19, 2024 Image Credits: Getty Images / Carol Yepes Welcome to

Llama 3 is out - Weekly News Roundup - Issue #463

Friday, April 19, 2024

Plus: brand-new, all-electric Atlas; AI Index Report 2024; Microsoft pitched GenAI tools to US military; Humane AI Pin reviews are in; debunking Devin; and more! ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Daily Coding Problem: Problem #1417 [Easy]

Friday, April 19, 2024

Daily Coding Problem Good morning! Here's your coding interview problem for today. This problem was asked by Wayfair. You are given a 2 x N board, and instructed to completely cover the board with

Charted | How Hard Is It to Get Into an Ivy League School? 🎓

Friday, April 19, 2024

We detail the admission rates and average annual cost for Ivy League schools, as well as the median SAT scores required to be accepted. View Online | Subscribe Presented by: Discover the motivations

Dark Matter & Tortured Poets

Friday, April 19, 2024

New music releases aren't what they used to be -- for good and bad. Dark Matter & Tortured Poets By MG Siegler • 19 Apr 2024 View in browser View in browser New music releases in 2024 are a

Impact of AI on Product Management

Friday, April 19, 2024

​ Impact of AI on Product Management The rise of the AI Product Manager. Product managers have always championed customer's needs. However, with AI, the job requires new technical and ethical

⚙️ Zuck has entered the chat(bot)

Friday, April 19, 2024

Plus: AI video's coming to mobile! ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌