Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
从 SQL 表中选择 2 个随机行的最快方法是什么?(仅 SQL 与否)我在 PhpMyAdmin 上使用 MySQL。
似乎会是:
SELECT * FROM table LIMIT 2
您将得到的是数据库默认顺序中的两行。
尝试这个:
SELECT * FROM table ORDER BY RAND() LIMIT 0, 2