Link to home
Start Free TrialLog in
Avatar of vickyjava
vickyjavaFlag for United States of America

asked on

Provide a SQL query that returns the user name and the total

Please provide the solution for the below query :

enclosed the script file with test data.

The table  IGBU_PROJ_RESOURCE holds information about users and their
corresponding location. Various holidays declared for each location
are stored in the table IGBU_LOC_HOLIDAY. Finally, there is a table
named IGBU_PROJ_TRACKING that holds information about the period range
during which resources worked on a project. In some case, the resource
might have worked only half-day and if so, the column half_day_flag
will have the value 'Y'. Otherwise, N is specified for full-day.
Specified period is stored in columns - start_date and end_date [both
inclusive]. In the specified date range, there may be weekends
(Saturday and Sunday) as well as declared holidays for the location
the resource belongs to.
(Some of the columns in the table are removed for keeping it simple)

Problem:  Provide a SQL query that returns the user name and the total
number of days worked on the project during the period 01-MAR-2012 and
31-MAR-2012 (both dates inclusive). Total number of days must exclude
declared holidays and weekends.

Expected Query Result
user_name            total_days
abc.user@oracle.com  6.5
mno.user@oracle.com  6.0
pqr.user@oracle.com  7.0
xyz.user@oracle.com  7.0
problem.sql
ASKER CERTIFIED SOLUTION
Avatar of Sean Stuber
Sean Stuber

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>Expected Query Result
user_name            total_days
abc.user@oracle.com  6.5
mno.user@oracle.com  6.0
pqr.user@oracle.com  7.0
xyz.user@oracle.com  7.0<<
Can you provide the actual table data for which those results are expected?
Avatar of Sean Stuber
Sean Stuber

he did  - it's what I tested with
Sorry, I missed seeing the attachment.
Avatar of vickyjava

ASKER

Thank you for your help its working!