Bug #80551 Syntax-errored sample statement on RAND function
Submitted: 29 Feb 2016 4:42 Modified: 29 Feb 2016 12:28
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Documentation Severity:S3 (Non-critical)
Version:5.1, 5.5, 5.6, 5.7 OS:Any
Assigned to: CPU Architecture:Any

[29 Feb 2016 4:42] Tsubasa Tanaka
Description:
There's syntax-errored statement on Doc of RAND function.

```
ORDER BY RAND() combined with LIMIT is useful for selecting a random sample from a set of rows:

mysql> SELECT * FROM table1, table2 WHERE a=b AND c<d -> ORDER BY RAND() LIMIT 1000;
```

"->" causes syntax error. It have to be removed.

How to repeat:
See

http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_rand
http://dev.mysql.com/doc/refman/5.1/en/mathematical-functions.html#function_rand
http://dev.mysql.com/doc/refman/5.5/en/mathematical-functions.html#function_rand
http://dev.mysql.com/doc/refman/5.6/en/mathematical-functions.html#function_rand
http://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_rand
http://dev.mysql.com/doc/refman/5.6/ja/mathematical-functions.html#function_rand

Suggested fix:
Remove "->" from statement.
[29 Feb 2016 5:07] MySQL Verification Team
thanks for the report!
[29 Feb 2016 12:28] Stefan Hinz
Posted by developer:
 
Thanks for reporting! Fixed.