Consecutive increases in annual earnings

InterviewQs

Consecutive increases in annual earnings

SQL Database Querying Window Function Lead Function

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

Hi, 

Suppose you are given two tables, showing the number of hours worked as well as the hourly rates for specific employees by year:

Table: employee_hours

employee_id hours_worked year
1 2200 2020
1 1900 2019
1 2300 2018
2 2200 2020
2 2000 2019
2 1850 2018
3 1850 2019
3 1920 2018

Table: employee_hourly_rates

employee_id hourly_rate_usd year
0001 45 2020
0001 42 2019
0001 40 2018
0002 40 2020
0002 40 2019
0002 40 2018
0003 55 2019
0003 50 2018

Given the above tables, write a SQL query to return the employees who generated more income (hours * hourly rate) in at least two consecutive years (either 2018-2019, 2019-2020, or all three years from 2018-2020).

You can view/query these tables in an interactive SQL fiddle here.



 

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

Older messages

Growth rate of US States

Friday, June 10, 2022

Python, Pandas, Merging Dataframes, Data Structures, External Dataset, InterviewQs Growth rate of US States Python Pandas Merging Dataframes Data Structures External Dataset Forward this email to a

Class lecture scheduling

Wednesday, June 8, 2022

Python, Data Structures, Arrays, Algorithms, InterviewQs Class lecture scheduling Python Data Structures Arrays Algorithms Forward this email to a friend or colleague and challenge them to solve it. Hi

Probability of disease

Monday, June 6, 2022

Statistics, Probability Theory, Conditional Probability, InterviewQs Probability of disease Statistics Probability Theory Conditional Probability Forward this email to a friend or colleague and

Projecting landfill volume

Saturday, June 4, 2022

SQL, Database Querying, Subquery, Forecast, InterviewQs Projecting landfill volume SQL Database Querying Subquery Forecast Forward this email to a friend or colleague and challenge them to solve it. Hi

Weather simulation using stochastic modeling

Wednesday, June 1, 2022

Python, Data Structures, Arrays, Markov Simulation, Markov Chains, Statistics, InterviewQs Weather simulation using stochastic modeling Python Data Structures Arrays Markov Simulation Markov Chains

You Might Also Like

Data Science Weekly - Issue 544

Friday, April 26, 2024

Curated news, articles and jobs related to Data Science, AI, & Machine Learning ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏ ͏

Develop highly relevant search applications using AI

Friday, April 26, 2024

New Elasticsearch and AI training ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ elastic | Search. Observe. Protect A world of AI possibilities door-test 2.png Explore

Stripe makes more changes

Thursday, April 25, 2024

TikTok is in trouble, and net neutrality is back View this email online in your browser By Christine Hall Thursday, April 25, 2024 Welcome back to TechCrunch PM, your home for all things startups,

💎 Issue 414 - From a Lorry Driver to Ruby on Rails Developer at 38

Thursday, April 25, 2024

This week's Awesome Ruby Newsletter Read this email on the Web The Awesome Ruby Newsletter Issue » 414 Release Date Apr 25, 2024 Your weekly report of the most popular Ruby news, articles and

💻 Issue 414 - JavaScript Features That Most Developers Don’t Know

Thursday, April 25, 2024

This week's Awesome Node.js Weekly Read this email on the Web The Awesome Node.js Weekly Issue » 414 Release Date Apr 25, 2024 Your weekly report of the most popular Node.js news, articles and

💻 Issue 407 - The Performance Impact of C++'s `final` Keyword

Thursday, April 25, 2024

This week's Awesome .NET Weekly Read this email on the Web The Awesome .NET Weekly Issue » 407 Release Date Apr 25, 2024 Your weekly report of the most popular .NET news, articles and projects

💻 Issue 414 - Everyone Has JavaScript, Right?

Thursday, April 25, 2024

This week's Awesome JavaScript Weekly Read this email on the Web The Awesome JavaScript Weekly Issue » 414 Release Date Apr 25, 2024 Your weekly report of the most popular JavaScript news, articles

📱 Issue 408 - All web browsers on iOS are just Safari with different design

Thursday, April 25, 2024

This week's Awesome iOS Weekly Read this email on the Web The Awesome iOS Weekly Issue » 408 Release Date Apr 25, 2024 Your weekly report of the most popular iOS news, articles and projects Popular

💧 Don't Bother Liquid Cooling Your AMD CPU — Why You Should Keep Using Live Photos on iPhone

Thursday, April 25, 2024

Also: We review the Unistellar Odyssey iPhone Telescope, and More! How-To Geek Logo April 25, 2024 Did You Know Charles Darwin and Abraham Lincoln were both born on the same day: February 12, 1809. 💻

💻 Issue 332 - 🥇The first framework that lets you visualize your React/NodeJS app 🤯

Thursday, April 25, 2024

This week's Awesome React Weekly Read this email on the Web The Awesome React Weekly Issue » 332 Release Date Apr 25, 2024 Your weekly report of the most popular React news, articles and projects