Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2011
    Posts
    2

    Unanswered: Learning Access/SQL Need Some Help.

    Hey everyone, I am taking an online Database class and I have had a heck of a time with this current assignment, particularly, question M.
    M. Write an SQL statement to show the sum of HoursWorked for each type of OWNER but exclude services of employees who have ExperienceLevel of Junior and exclude any type with less than three members.

    Tables:
    OWNER(OwnerID, OwnerName,OwnerEmail,OwnerType)
    PROPERTY(PropertyID, PropertyName, Street, City, State, Zip, OwnerID)
    EMPLOYEE(EmployeeID, LastName,FirstName, CellPhone, ExperienceLevel)
    SERVICE(PropertyID, EmployeeID, ServiceDate, HoursWorked)

    Used strikeouts for primary keys.
    Referential Integrity Constraints:
    OwnerID in PROPERTY must exist in OwnerID in OWNER
    PropertyID in SERVICE must exist in PropertyID in PROPERTY
    EmployeeID in SERVICE must exist in EmployeeID in EMPLOYEE

    So far I have
    SELECT OWNER.OwnerType, SUM(HoursWorked) AS TotalHours
    FROM SERVICE, OWNER, EMPLOYEE, PROPERTY
    WHERE EMPLOYEE.EmployeeID = SERVICE.EmployeeID AND OWNER.OwnerID = PROPERTY.OwnerID AND EMPLOYEE.ExperienceLevel NOT LIKE 'Junior'
    GROUP BY OWNER.OwnerType
    HAVING COUNT(*)>2;

    For some reason it is showing values that are adding up to numbers that are much larger than they should be. Where am I going wrong? Any help would be great.

  2. #2
    Join Date
    Sep 2011
    Posts
    19

    Learning Access/SQL Need Some Help

    We're not supposed to answer questions pertaining to homework assignments, because we all had to learn this at some point in our lives and giving you the answer wouldn't be helping you.

    I'm not going to give you the answer or write out the SQL Statement that would help you out, however, I will give you a hint.

    Make sure you are reviewing what tables each field's information is coming from, and make sure you are declaring that in your SQL statement.

    I am a little rusty with my SQL, but I see that error in your SQL so far.

  3. #3
    Join Date
    Oct 2011
    Posts
    2
    Quote Originally Posted by Ari Potter View Post
    We're not supposed to answer questions pertaining to homework assignments, because we all had to learn this at some point in our lives and giving you the answer wouldn't be helping you.

    I'm not going to give you the answer or write out the SQL Statement that would help you out, however, I will give you a hint.

    Make sure you are reviewing what tables each field's information is coming from, and make sure you are declaring that in your SQL statement.

    I am a little rusty with my SQL, but I see that error in your SQL so far.
    I most certainly wasn't expecting the work to be done for me. Getting a hint is all I was hoping for since I have been looking at this code for so long I have gone blind to what might be wrong. I'll look at it again soon as I get a chance. Thank you for your input.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •