Results 1 to 2 of 2

Thread: SQL RAND() function and ORDER BY clause

  1. #1

    SQL RAND() function and ORDER BY clause

    Hi All,

    In order to pick up the records in a random way, I use RAND() function. Opposite to this, I user ORDER BY. Without using ORDER BY, the query displays the records in a random order. Hence, I do not see any other use of RAND() function. Is this correct ? Are there any other benefits in RAND() function ?


  2. #2
    Moderator
    Join Date
    Oct 2005
    Answers
    305

    Re: SQL RAND() function and ORDER BY clause

    Without "ORDER BY" clause, the rows are returned in an unpredictable way. However if the database is indexed, then the ordering will depend on such indexes.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact