Results 1 to 9 of 9

Thread: Database query

  1. #1
    Join Date
    Feb 2012
    Posts
    5

    Unanswered: Database query

    Hi,

    I need urgent answer to this query. I need a sql query to get 3-11 table from 3-10

    Calculate the employee attrition Table 3-11 from the Employee master, Table 3-10

    Table 3-10: Employee Master

    Employee ID Start Date Termination Date Performance Level
    1 1/1/2007 3/1/2007 Low
    2 6/5/2004 Medium
    3 4/3/2003 High
    4 9/1/2002 4/15/2007 Medium
    5 4/6/2007 11/1/2007 Low
    6 7/1/2007 High
    7 3/2/2005 8/1/2007 Low

    Table 3-11: Employee Attrition

    Period Total Employees at end of quarter High Performers Medium Performers Low Performers Total Attrition Low Performer Attrition Medium Performer Attrition High Performer Attrition
    Q1 2007 4 1 2 1 1 1 0 0
    Q2 2007 4 1 1 2 1 0 1 0
    Q3 2007 4 2 1 1 1 1 0 0
    Q4 2007 3 2 1 0 1 1 0 0
    Last edited by sqlprogrammer1; 02-17-12 at 01:25. Reason: More details

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    The question looks same as in MySQL forum.
    Quote Originally Posted by sqlprogrammer1 View Post
    Hi,

    I need urgent answer to this query. Need to write a sql query to get table 3-11 from 3-10

    Calculate the employee attrition Table 3-11 from the Employee master, Table 3-10

    ...

  3. #3
    Join Date
    Feb 2012
    Posts
    5

    yes

    I need answer urgently so I posted in both the forums. Sorry about that.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    desperate sql student is desperate
    homework is due and she hasn't a clue
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  5. #5
    Join Date
    Nov 2004
    Posts
    1,427
    Provided Answers: 4
    You will find a lot of people here willing to help you out, but very few willing to do your homework for you.

    Show us what you have got till now and we'll help you further.

    Start by building your result set step by step.
    How would you create the Period result?

    4 9/1/2002 4/15/2007 Medium
    This period starts in Q3 2002 ..... and ends in Q2 2007. What is the business logic to convert it into Period in the result?
    Q3 2002, Q2 2007, both Q3 2002 and Q2 2007, all Q3 2002 | Q4 2002 | Q1 2003 | ... | Q1 2007 | Q2 2007, .... ?

    When you got that, continue with "Employees at end of quarter" and so on.
    With kind regards . . . . . SQL Server 2000/2005/2012
    Wim

    Grabel's Law: 2 is not equal to 3 -- not even for very large values of 2.
    Pat Phelan's Law: 2 very definitely CAN equal 3 -- in at least two programming languages

  6. #6
    Join Date
    Jan 2013
    Posts
    1
    Hi, HAve you found and answer yet? Even Im looking for the answer!!!

  7. #7
    Join Date
    Jan 2013
    Posts
    354
    Provided Answers: 1
    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.

    This is minimal polite behavior on SQL forums.

    Sample data is also a good idea, along with clear specifications. It is very hard to debug code when you do not let us see it.

  8. #8
    Join Date
    Aug 2004
    Location
    Dallas, Texas
    Posts
    831
    Yikes! Joe this is a yearly post. OP probably failed class and became successful programmer for a fortune 50 company.

  9. #9
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Quote Originally Posted by Celko View Post
    This is minimal polite behavior on SQL forums.
    ...again Joe, not on this forum.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Tags for this Thread

Posting Permissions

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