Random unions

  • Comments posted to this topic are about the item Random unions

  • This was removed by the editor as SPAM

  • Nice question, thanks.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Great simple question... Was looking for the catch, and very glad there wasn't one!

  • Thank you for the post, Steve, good one.

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Michael Riemer (10/23/2014)


    ,,Was looking for the catch...!

    If i had 1 rupee everytime i did or said that, i would have brought a 1tb PHD....:-D

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • Nice question!

    I was surprised that the final RAND() also returns a constant value after a previous call with a seed. It's in the Remarks in BOL, so I guess it's by design.

  • Amusing question; the use of RAND is an interesting distraction for a question that is really about UNION ALL and nothing else.

    Tom

  • Thanks for the easy points :hehe:

    ---------------
    Mel. 😎

  • TomThomson (10/23/2014)


    Amusing question; the use of RAND is an interesting distraction for a question that is really about UNION ALL and nothing else.

    I agree. I focused on what the RAND would return, and completely missed it was UNION ALL, and not UNION.

  • Michael Riemer (10/23/2014)


    Great simple question... Was looking for the catch, and very glad there wasn't one!

    The catch is that almost the same question was asked on 2014/09/29, except that one used UNION instead of UNION ALL...

  • Good reminder about the ALL part of UNION. I've got myself caught up when I wanted all rows and forgot to use the ALL. My duplicates, which I wanted, disappeared. Silly me.

  • Nice question, Steve. I thought that the values in the third column would be different in each row, but I forgot that the seeds set the sequence for subsequent calls. Fortunately, I caught the ALLs and realized that the values returned by RAND didn't matter; all three rows would be returned whether they were identical or not.

  • Nice question, it's not trivia and it doesn't rely on intentionally misleading syntax.

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

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