SQL Quiz

  • Removed as per the wish of a user !

  • I think you need below link:

    https://www.sqlservercentral.com/Forums/2007880/Date-Field-Calculation-Logic

    Saravanan

  • This looks like it works, although GW's dod is incorrect in sample data

    select ( SELECT count(1) N
          FROM #President p
          WHERE IsNull(p1.DiedDate,'1/1/2020') between p.StartDate and IsNull(p.DiedDate,'1/1/2020')
      
            ) as NumberOfPresidentsAlive,
            p1.StartDate,
            p1.DiedDate,
        STUFF(
            ( SELECT ',' + p.Name
          FROM #President p
          WHERE IsNull(p1.DiedDate,'1/1/2020') between p.StartDate and IsNull(p.DiedDate,'1/1/2020')
          FOR XML PATH('')
       ),
       1,
       1,''
        
            ) PresidentNames
            
    from #President p1
    order by 1 desc, 2
        

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Homework!!

    ...

  • HappyGeek - Wednesday, December 5, 2018 9:39 AM

    Homework!!

    Slow day 😉

    For better, quicker answers, click on the following...
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Appreciate your response -  Mike01saravanatn and HappyGeek.

  • First order of business was to correct the data.   Any of a number of rows had data issues, and the death date required update for George H.W. Bush from NULL at this point.   I'm quite sure this is NOT the most efficient, but not limiting the results to the top 3; which do differ from the results presented, probably because the data was so far off; does reveal some interesting information, such as the number of presidents who were the sole living president, and for some rather long times....

    Here's the query:
    IF OBJECT_ID('tempdb..#Presidents') IS NOT NULL
        BEGIN;
        DROP TABLE #Presidents;
        END;

    CREATE TABLE #Presidents (
        PresidentID    int IDENTITY(1,1) PRIMARY KEY CLUSTERED,
        Name        varchar(60),
        StartDate    date,
        DiedDate    date
    ) WITH (DATA_COMPRESSION=PAGE);
    CREATE NONCLUSTERED INDEX TEMP_Presidents_StartDate_DiedDate_INCLUDE_Name ON #Presidents
        (
        StartDate ASC,
        DiedDate ASC
        )
        INCLUDE
            (
            Name,
            PresidentID
            );

    INSERT INTO #Presidents (Name, StartDate, DiedDate)
        VALUES    ('George Washington',        '04/30/1789', '12/14/1799'),
                ('John Adams',                '03/04/1797', '07/04/1826'),
                ('Thomas Jefferson',        '03/04/1801', '07/04/1826'),
                ('James Madison',            '03/04/1809', '06/28/1836'),
                ('James Monroe',            '03/04/1817', '07/04/1831'),
                ('John Quincy Adams',        '03/04/1825', '02/23/1848'),
                ('Andrew Jackson',            '03/04/1829', '06/08/1845'),
                ('Martin Van Buren',        '03/04/1837', '07/24/1862'),
                ('William Henry Harrison',    '03/04/1841', '04/04/1841'),
                ('John Tyler',                '04/04/1841', '01/18/1862'),
                ('James K. Polk',            '03/04/1845', '06/15/1849'),
                ('Zachary S. Taylor',        '03/04/1849', '07/09/1850'),
                ('Millard Fillmore',        '07/09/1850', '03/08/1874'),
                ('Franklin Pierce',            '03/04/1853', '10/08/1869'),
                ('James Buchanan',            '03/04/1857', '06/01/1868'),
                ('Abraham Lincoln',            '03/04/1861', '04/15/1865'),
                ('Andrew Johnson',            '04/15/1865', '07/31/1875'),
                ('Ulysses S. Grant',        '03/04/1869', '07/23/1885'),
                ('Rutherford B. Hayes',        '03/04/1877', '01/17/1893'),
                ('James A. Garfield',        '03/04/1881', '09/19/1881'),
                ('Chester A. Arthur',        '09/19/1881', '11/18/1886'),
                ('Stephen Grover Cleveland','03/04/1885', '06/24/1908'),
                ('Benjamin Harrison',        '03/04/1889', '03/13/1901'),
                ('Stephen Grover Cleveland','03/04/1893', '06/24/1908'),
                ('William McKinley',        '03/04/1897', '09/14/1901'),
                ('Theodore Roosevelt',        '09/14/1901', '01/06/1919'),
                ('William Howard Taft',        '03/04/1909', '03/08/1930'),
                ('Thomas Woodrow Wilson',    '03/04/1913', '02/03/1924'),
                ('Warren G. Harding',        '03/04/1921', '08/02/1923'),
                ('John Calvin Coolidge',    '08/02/1923', '01/05/1933'),
                ('Herbert C. Hoover',        '03/04/1929', '10/20/1964'),
                ('Franklin D. Roosevelt',    '03/04/1933', '04/12/1945'),
                ('Harry S. Truman',            '04/12/1945', '12/26/1972'),
                ('Dwight D. Eisenhower',    '01/20/1953', '03/28/1969'),
                ('John F. Kennedy',            '01/20/1961', '11/22/1963'),
                ('Lyndon B. Johnson',        '11/22/1963', '01/22/1973'),
                ('Richard M. Nixon',        '01/20/1969', '04/22/1994'),
                ('Gerald R. Ford',            '08/09/1974', '12/26/2006'),
                ('James E. Carter',            '01/20/1977', NULL),
                ('Ronald W. Reagan',        '01/20/1981', '06/05/2004'),
                ('George H. W. Bush',        '01/20/1989', '11/30/2018'),
                ('William J. Clinton',        '01/20/1993', NULL),
                ('George W. Bush',            '01/20/2001', NULL),
                ('Barack H. Obama',            '01/20/2009', NULL),
                ('Donald J. Trump',            '01/20/2017', NULL);

    -- Variable to hold the earliest date to look at.
    DECLARE @MinDate AS date = (SELECT MIN(StartDate) FROM #Presidents);
    DECLARE @NumDays AS int = DATEDIFF(day, @MinDate, CONVERT(Date, GETDATE())) + 1;

    WITH People AS (

        SELECT
            P.Name,
            MIN(P.StartDate) AS MIN_StartDate,
            P.DiedDate
        FROM #Presidents AS P
        GROUP BY
            P.Name,
            P.DiedDate
    ),
        Ten AS (

            SELECT N
            FROM (VALUES (1),(1),(1),(1),(1),(1),(1),(1),(1),(1)) AS X(N)
    ),
        AllDates AS (

            SELECT TOP (@NumDays) DATEADD(day, ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) - 1, @MinDate) AS TheDate,
                ROW_NUMBER() OVER(ORDER BY (SELECT NULL)) AS RowNum
            FROM Ten AS T1, Ten AS T2, Ten AS T3, Ten AS T4, Ten AS T5, Ten AS T6
    ),
        PresidentsList AS (

            SELECT
                D.RowNum,
                D.TheDate,
                PC.PresidentCount,
                STUFF(P.NameList, 1, 2, '') AS NameList
            FROM AllDates AS D
                OUTER APPLY (
                    SELECT COUNT(DISTINCT P1.Name) AS PresidentCount
                    FROM People AS P1
                    WHERE D.TheDate BETWEEN P1.MIN_StartDate AND ISNULL(P1.DiedDate, CONVERT(date, GETDATE()))
                    ) AS PC
                OUTER APPLY (
                    SELECT ', ' + P2.Name
                    FROM People AS P2
                    WHERE D.TheDate BETWEEN P2.MIN_StartDate AND ISNULL(P2.DiedDate, CONVERT(date, GETDATE()))
                    ORDER BY P2.MIN_StartDate
                    FOR XML PATH('')
                ) AS P (NameList)
    )
    SELECT    --TOP (100) WITH TIES
        MIN(PL.TheDate) AS DateRangeStart,
        MAX(PL.TheDate) AS DateRangeEnd,
        MAX(PL.PresidentCount) AS PresidentCount,
        MAX(PL.RowNum) - MIN(PL.RowNum) + 1 AS DayCount,
        PL.NameList
    FROM PresidentsList AS PL
    GROUP BY PL.NameList
    ORDER BY
        MAX(PL.PresidentCount) DESC,
        MAX(PL.RowNum) - MIN(PL.RowNum) + 1 DESC;

    Here's the full result set:
    DateRangeStart DateRangeEnd PresidentCount DayCount     NameList
    -------------- ------------ -------------- -------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    2001-01-20  2004-06-05 6     1233      Gerald R. Ford, James E. Carter, Ronald W. Reagan, George H. W. Bush, William J. Clinton, George W. Bush
    2017-01-20  2018-11-30 6     680      James E. Carter, George H. W. Bush, William J. Clinton, George W. Bush, Barack H. Obama, Donald J. Trump
    1993-01-20  1994-04-22 6     458      Richard M. Nixon, Gerald R. Ford, James E. Carter, Ronald W. Reagan, George H. W. Bush, William J. Clinton
    1861-03-04  1862-01-18 6     321      Martin Van Buren, John Tyler, Millard Fillmore, Franklin Pierce, James Buchanan, Abraham Lincoln
    2009-01-20  2017-01-19 5     2922      James E. Carter, George H. W. Bush, William J. Clinton, George W. Bush, Barack H. Obama
    1994-04-23  2001-01-19 5     2464      Gerald R. Ford, James E. Carter, Ronald W. Reagan, George H. W. Bush, William J. Clinton
    1857-03-04  1861-03-03 5     1461      Martin Van Buren, John Tyler, Millard Fillmore, Franklin Pierce, James Buchanan
    1989-01-20  1993-01-19 5     1461      Richard M. Nixon, Gerald R. Ford, James E. Carter, Ronald W. Reagan, George H. W. Bush
    2004-06-06  2006-12-26 5     934      Gerald R. Ford, James E. Carter, George H. W. Bush, William J. Clinton, George W. Bush
    1825-03-04  1826-07-04 5     488      John Adams, Thomas Jefferson, James Madison, James Monroe, John Quincy Adams
    1862-01-19  1862-07-24 5     187      Martin Van Buren, Millard Fillmore, Franklin Pierce, James Buchanan, Abraham Lincoln
    1845-03-04  1845-06-08 5     97       John Quincy Adams, Andrew Jackson, Martin Van Buren, John Tyler, James K. Polk
    2018-12-01  2018-12-12 5     12       James E. Carter, William J. Clinton, George W. Bush, Barack H. Obama, Donald J. Trump
    1841-04-04  1841-04-04 5     1       John Quincy Adams, Andrew Jackson, Martin Van Buren, William Henry Harrison, John Tyler
    1963-11-22  1963-11-22 5     1       Herbert C. Hoover, Harry S. Truman, Dwight D. Eisenhower, John F. Kennedy, Lyndon B. Johnson
    1865-04-15  1865-04-15 5     1       Millard Fillmore, Franklin Pierce, James Buchanan, Abraham Lincoln, Andrew Johnson
    1981-01-20  1989-01-19 4     2922      Richard M. Nixon, Gerald R. Ford, James E. Carter, Ronald W. Reagan
    1817-03-04  1825-03-03 4     2922      John Adams, Thomas Jefferson, James Madison, James Monroe
    1853-03-04  1857-03-03 4     1461      Martin Van Buren, John Tyler, Millard Fillmore, Franklin Pierce
    1841-04-05  1845-03-03 4     1429      John Quincy Adams, Andrew Jackson, Martin Van Buren, John Tyler
    1865-04-16  1868-06-01 4     1143      Millard Fillmore, Franklin Pierce, James Buchanan, Andrew Johnson
    1961-01-20  1963-11-21 4     1036      Herbert C. Hoover, Harry S. Truman, Dwight D. Eisenhower, John F. Kennedy
    1862-07-25  1865-04-14 4     995      Millard Fillmore, Franklin Pierce, James Buchanan, Abraham Lincoln
    1845-06-09  1848-02-23 4     990      John Quincy Adams, Martin Van Buren, John Tyler, James K. Polk
    1829-03-04  1831-07-04 4     853      James Madison, James Monroe, John Quincy Adams, Andrew Jackson
    2006-12-27  2009-01-19 4     755      James E. Carter, George H. W. Bush, William J. Clinton, George W. Bush
    1963-11-23  1964-10-20 4     333      Herbert C. Hoover, Harry S. Truman, Dwight D. Eisenhower, Lyndon B. Johnson
    1869-03-04  1869-10-08 4     219      Millard Fillmore, Franklin Pierce, Andrew Johnson, Ulysses S. Grant
    1885-03-04  1885-07-23 4     142      Ulysses S. Grant, Rutherford B. Hayes, Chester A. Arthur, Stephen Grover Cleveland
    1849-03-04  1849-06-15 4     104      Martin Van Buren, John Tyler, James K. Polk, Zachary S. Taylor
    1969-01-20  1969-03-28 4     68       Harry S. Truman, Dwight D. Eisenhower, Lyndon B. Johnson, Richard M. Nixon
    1841-03-04  1841-04-03 4     31       John Quincy Adams, Andrew Jackson, Martin Van Buren, William Henry Harrison
    1850-07-09  1850-07-09 4     1       Martin Van Buren, John Tyler, Zachary S. Taylor, Millard Fillmore
    1881-09-19  1881-09-19 4     1       Ulysses S. Grant, Rutherford B. Hayes, James A. Garfield, Chester A. Arthur
    1923-08-02  1923-08-02 4     1       William Howard Taft, Thomas Woodrow Wilson, Warren G. Harding, John Calvin Coolidge
    1809-03-04  1817-03-03 3     2922      John Adams, Thomas Jefferson, James Madison
    1953-01-20  1961-01-19 3     2922      Herbert C. Hoover, Harry S. Truman, Dwight D. Eisenhower
    1913-03-04  1919-01-06 3     2135      Theodore Roosevelt, William Howard Taft, Thomas Woodrow Wilson
    1831-07-05  1836-06-28 3     1821      James Madison, John Quincy Adams, Andrew Jackson
    1869-10-09  1874-03-08 3     1612      Millard Fillmore, Andrew Johnson, Ulysses S. Grant
    1964-10-21  1969-01-19 3     1552      Harry S. Truman, Dwight D. Eisenhower, Lyndon B. Johnson
    1897-03-04  1901-03-13 3     1470      Stephen Grover Cleveland, Benjamin Harrison, William McKinley
    1977-01-20  1981-01-19 3     1461      Richard M. Nixon, Gerald R. Ford, James E. Carter
    1837-03-04  1841-03-03 3     1461      John Quincy Adams, Andrew Jackson, Martin Van Buren
    1889-03-04  1893-01-17 3     1416      Rutherford B. Hayes, Stephen Grover Cleveland, Benjamin Harrison
    1969-03-29  1972-12-26 3     1369      Harry S. Truman, Lyndon B. Johnson, Richard M. Nixon
    1881-09-20  1885-03-03 3     1261      Ulysses S. Grant, Rutherford B. Hayes, Chester A. Arthur
    1826-07-05  1829-03-03 3     973      James Madison, James Monroe, John Quincy Adams
    1850-07-10  1853-03-03 3     968      Martin Van Buren, John Tyler, Millard Fillmore
    1921-03-04  1923-08-01 3     881      William Howard Taft, Thomas Woodrow Wilson, Warren G. Harding
    1885-07-24  1886-11-18 3     483      Rutherford B. Hayes, Chester A. Arthur, Stephen Grover Cleveland
    1849-06-16  1850-07-08 3     388      Martin Van Buren, John Tyler, Zachary S. Taylor
    1848-02-24  1849-03-03 3     374      Martin Van Buren, John Tyler, James K. Polk
    1929-03-04  1930-03-08 3     370      William Howard Taft, John Calvin Coolidge, Herbert C. Hoover
    1868-06-02  1869-03-03 3     275      Millard Fillmore, Franklin Pierce, Andrew Johnson
    1881-03-04  1881-09-18 3     199      Ulysses S. Grant, Rutherford B. Hayes, James A. Garfield
    1923-08-03  1924-02-03 3     185      William Howard Taft, Thomas Woodrow Wilson, John Calvin Coolidge
    1901-09-14  1901-09-14 3     1       Stephen Grover Cleveland, William McKinley, Theodore Roosevelt
    1945-04-12  1945-04-12 3     1       Herbert C. Hoover, Franklin D. Roosevelt, Harry S. Truman
    1933-03-04  1945-04-11 2     4422      Herbert C. Hoover, Franklin D. Roosevelt
    1801-03-04  1809-03-03 2     2922      John Adams, Thomas Jefferson
    1945-04-13  1953-01-19 2     2839      Herbert C. Hoover, Harry S. Truman
    1901-09-15  1908-06-24 2     2475      Stephen Grover Cleveland, Theodore Roosevelt
    1924-02-04  1929-03-03 2     1855      William Howard Taft, John Calvin Coolidge
    1893-01-18  1897-03-03 2     1506      Stephen Grover Cleveland, Benjamin Harrison
    1909-03-04  1913-03-03 2     1461      Theodore Roosevelt, William Howard Taft
    1877-03-04  1881-03-03 2     1461      Ulysses S. Grant, Rutherford B. Hayes
    1930-03-09  1933-01-05 2     1034      John Calvin Coolidge, Herbert C. Hoover
    1797-03-04  1799-12-14 2     1016      George Washington, John Adams
    1974-08-09  1977-01-19 2     895      Richard M. Nixon, Gerald R. Ford
    1886-11-19  1889-03-03 2     836      Rutherford B. Hayes, Stephen Grover Cleveland
    1919-01-07  1921-03-03 2     787      William Howard Taft, Thomas Woodrow Wilson
    1874-03-09  1875-07-31 2     510      Andrew Johnson, Ulysses S. Grant
    1836-06-29  1837-03-03 2     248      John Quincy Adams, Andrew Jackson
    1901-03-14  1901-09-13 2     184      Stephen Grover Cleveland, William McKinley
    1972-12-27  1973-01-22 2     27       Lyndon B. Johnson, Richard M. Nixon
    1789-04-30  1797-03-03 1     2865      George Washington
    1875-08-01  1877-03-03 1     581      Ulysses S. Grant
    1973-01-23  1974-08-08 1     563      Richard M. Nixon
    1799-12-15  1801-03-03 1     444      John Adams
    1908-06-25  1909-03-03 1     252      Theodore Roosevelt
    1933-01-06  1933-03-03 1     57       Herbert C. Hoover

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Hello all!

    I am the author to this question. 

    Two notes to anyone finding this thread and trying to find a solution:
    1.) Anyone receiving this question directly is expected to provide their own solution to it.
    2.) I will absolutely know if they did not create their own solution to it and that just wastes everyone's time

  • I don't know who you are but I still removed the post !

    You cannot claim that you are the one who really framed the question !! Where is the proof ?

    You are free to know what you want to know !! Nobody can stop you ! 

    Thanks.

  • And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

  • Lynn Pettis - Monday, January 7, 2019 4:08 PM

    And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

    Well said !!

  • Lynn Pettis - Monday, January 7, 2019 4:08 PM

    And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

    Actually, I've confirmed the intent of the author of this problem by speaking with said author.  As was stated in the original post, this is part of an exam for a job position and the two people that have posted the question are totally out of line asking for a solution on a forum to try to get the job.  It's worse than all the people we reprimand for "not trying" on questions that are homework or test questions from some college.  I've also discovered and confirmed the nature of the job and I have to say that I wouldn't want someone in such a position of responsibility.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Wednesday, January 9, 2019 8:29 AM

    Lynn Pettis - Monday, January 7, 2019 4:08 PM

    And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

    Actually, I've confirmed the intent of the author of this problem by speaking with said author.  As was stated in the original post, this is part of an exam for a job position and the two people that have posted the question are totally out of line asking for a solution on a forum to try to get the job.  It's worse than all the people we reprimand for "not trying" on questions that are homework or test questions from some college.  I've also discovered and confirmed the nature of the job and I have to say that I wouldn't want someone in such a position of responsibility.

    Here here, Jeff.  I agree that these individuals were totally out of line asking for a solution here to get a job.  Unfortunately it seems to be how things are getting done today.

  • Lynn Pettis - Wednesday, January 9, 2019 9:20 AM

    Jeff Moden - Wednesday, January 9, 2019 8:29 AM

    Lynn Pettis - Monday, January 7, 2019 4:08 PM

    And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

    Actually, I've confirmed the intent of the author of this problem by speaking with said author.  As was stated in the original post, this is part of an exam for a job position and the two people that have posted the question are totally out of line asking for a solution on a forum to try to get the job.  It's worse than all the people we reprimand for "not trying" on questions that are homework or test questions from some college.  I've also discovered and confirmed the nature of the job and I have to say that I wouldn't want someone in such a position of responsibility.

    Here here, Jeff.  I agree that these individuals were totally out of line asking for a solution here to get a job.  Unfortunately it seems to be how things are getting done today.

    I'm trying to help the "unfortunately" part of that.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Jeff Moden - Wednesday, January 9, 2019 9:29 AM

    Lynn Pettis - Wednesday, January 9, 2019 9:20 AM

    Jeff Moden - Wednesday, January 9, 2019 8:29 AM

    Lynn Pettis - Monday, January 7, 2019 4:08 PM

    And someone else has posted this same question, so who is to know who really came up with it and more importantly, who really cares.

    Actually, I've confirmed the intent of the author of this problem by speaking with said author.  As was stated in the original post, this is part of an exam for a job position and the two people that have posted the question are totally out of line asking for a solution on a forum to try to get the job.  It's worse than all the people we reprimand for "not trying" on questions that are homework or test questions from some college.  I've also discovered and confirmed the nature of the job and I have to say that I wouldn't want someone in such a position of responsibility.

    Here here, Jeff.  I agree that these individuals were totally out of line asking for a solution here to get a job.  Unfortunately it seems to be how things are getting done today.

    I'm trying to help the "unfortunately" part of that.

    One way is to delay answering questions but that is just a knee jerk response.  It seems to be our changing times where many expect instance answers, along the lines of instant gratification.  For use old timers we remember having to learn things the hard way, without the benefit of the internet.  Books, experimentation (trial and error), and if lucky having a mentor to work with.

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic. Login to reply