Need help with my HW brews and brehettes...SQL related!!

HabitualLineSteppa

....Fuh Q.
Joined
May 1, 2012
Messages
2,634
Reputation
1,201
Daps
9,599
Here it is...

I'm in a SQL server course presently and I am in dire need of assistance. To all my programming/DB heads, pardon the basic-ness of the following request however I've searched high and low and honestly the reading material in the course alludes me..

Here's the issue:

"Assuming that today’s date is 12/2/2025, create a temporary field that calculates the total service time (in years) of each
employee.

In the same query, use a CASE statement to identify employees who are over 54 years old and have over 20 years of service time with the company. Identify them as “Potential Retirees”".

For reference, these are the tables and column I at least KNOW this data will derive from

Table Names: Employee

Columns needing to be manipulated: employee.HireDate, employee.FirstName, employee.LastName, employee.age


Any help will be greatly appreciated!!!!

Reach one, teach one...:to: :heh:
 
Last edited:

Rawtid

Veteran
Supporter
Joined
Jun 23, 2012
Messages
43,323
Reputation
14,678
Daps
119,448
You need the employees age and years of service too

Age = today minus birthdate
Days of service =today minus hire date. Turn it into years
 

GoPro

EscoBeard Season Has Returned
Supporter
Joined
May 1, 2012
Messages
12,719
Reputation
2,261
Daps
32,548
Reppin
#CertLife #ITGang
Where all the certs brehs at? Help this dude reach the 6 figures, 6 series, 6 model bytches Promised Land.









And while you're at it, help me too :sadcam::blessed:
 

Chris.B

Banned
Joined
Jun 22, 2012
Messages
18,922
Reputation
-4,624
Daps
21,894
Are they expecting you to use GUI or CLI?

This is more of a SQL/DB question than a programming question.
 

Rawtid

Veteran
Supporter
Joined
Jun 23, 2012
Messages
43,323
Reputation
14,678
Daps
119,448
Case when age > 54 and years of service > 20 then "potential whatever "

Look in the book for the case syntax but that's the gist of it
 

HabitualLineSteppa

....Fuh Q.
Joined
May 1, 2012
Messages
2,634
Reputation
1,201
Daps
9,599
You need the employees age and years of service too

Age = today minus birthdate
Days of service =today minus hire date. Turn it into years

Aight so here goes:

Dates of hire prior to 12/02/2025 and their ages at the time of hire:

2003-10-07 64
1999-10-29 32
2001-04-27 27
2000-08-16 26
1998-09-27 25
1998-03-01 51
2000-06-01 34
2003-03-12 24
2003-11-01 18
2003-07-25 25
2003-07-12 24
 

HabitualLineSteppa

....Fuh Q.
Joined
May 1, 2012
Messages
2,634
Reputation
1,201
Daps
9,599
Don't you want their current age?
Yes and no...The way the instruction is written, is as stated in the OP...Thing is, I cannot calculate their respective ages without knowing what their DOB's are...None of the previous data provided accounts for this...:sadbron::snoop:
 

Rawtid

Veteran
Supporter
Joined
Jun 23, 2012
Messages
43,323
Reputation
14,678
Daps
119,448
Yes and no...The way the instruction is written, is as stated in the OP...Thing is, I cannot calculate their respective ages without knowing what their DOB's are...None of the previous data provided accounts for this...:sadbron::snoop:
Wow The date of birth isn't in the table?
 
Top