forum

Home / DeveloperSection / Forums / Struggling with SQL Query

Struggling with SQL Query

adhyaa khare 238 21-May-2023

Hello everyone,

I am trying to solve an SQL query problem but I am having difficulty. I am trying to write a query that returns a list of employees who have worked in at least one department for more than 8 years.

The database consists of two tables:

Employee Table

Name | Age | Department

John | 30 | Marketing

Sara | 32 | Finance

Alice | 25 | HR

Employee History Table

Name | Department | Years of Experience

John | Marketing | 5

John | HR | 1

Sara | Finance | 8

Alice | HR | 10

I am trying to write a query to return the names of the employees and the departments they have worked in for more than 8 years, but I am having difficulty coming up with the correct syntax. Any help would be greatly appreciated!

Thank you.


Updated on 27-Jul-2023
Just like architecture, which is an art used by people daily and affects their everyday life, so is code. You can create something that people interact with, use, touch, and work with. That is an amazing feeling.

Can you answer this question?


Answer

2 Answers

Liked By