How does mysql randomly extract 10 entries from the database?

Source: Internet
Author: User



Problem
How to randomly extract 10 entries from the database?
Solution
Are there any good solutions, which are highly efficient and easy to use.


Reference answer
If you have a cache system... load it directly from the cache ....
Reference answer
No ~
Reference answer
Random syntax...
Reference answer
Why not use the Rand function?
Reference answer
Rand must be used, but I don't know how to write this SQL statement.
Reference answer
SELECT... FROM... WHERE... order by rand () LIMIT 10


Copy code
Reference answer
Posted by Fising at [url = http://bbs.111cn.cn/redirect.php? Goto = findpost & pid = 814691 & ptid = 100356] link mark [img] http://bbs.111cn.cn/images/common/back.gif?/img=#/url]
SELECT... FROM... WHERE... order by rand () LIMIT 10
Learning
Reference answer
Thank you. I wrote it like this just now, but the prompt is that the statement is incorrect. Is it true that rand must be capitalized? An error occurred while I wrote it in lower case.
Reference answer
[Url = http://www.linvo2008.cn/blog? P = 7] link tag http://www.linvo2008.cn/blog? P = 7 [/url]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.