Users Pricing

forum

home / developersection / forums / struggling with sql query

Struggling with SQL Query

adhyaa khare 751 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.


adhyaa khare

Student

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.


2 Answers

Aryan Kumar 23 May 2023 Accepted Answer
Ravi Vishwakarma 21 May 2023 Accepted Answer