易截截图软件、单文件、免安装、纯绿色、仅160KB

关于mysql 的order by rand()

 官方手册上是这么写的:
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体";
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0cm;
margin-bottom:.0001pt;
text-align:justify;
text-justify:inter-ideograph;
mso-pagination:none;
font-size:10.5pt;
mso-bidi-font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:宋体;
mso-font-kerning:1.0pt;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
/* Page Definitions */
@page
{mso-page-border-surround-header:no;
mso-page-border-surround-footer:no;}
@page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;
mso-header-margin:36.0pt;
mso-footer-margin:36.0pt;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
You cannot
use a column with RAND()
values in an ORDER BY clause, because ORDER BY would evaluate the column
multiple times. However, you can retrieve rows in random order like this:
mysql> SELECT
* from tbl_name
ORDER BY RAND();
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;
RAND()
is not meant to be a perfect random generator, but instead is a fast way to
generate ad hoc
random numbers which is portable between platforms for
the same MySQL ver


相关文档:

MySQL数据库备份的基础知识大全

平时我们在使用MySQL数据库的时候经常会因为操作失误造成数据丢失,MySQL数据库备份可以帮助我们避免由于各种原因造成的数据丢失或着数据库的其他问题。
  一、数据备份捷径
  因为这个方法没有得到官方正式文档的验证,我们暂称为试验吧。
  目的:备份hostA主机中一个MySQL数据库备份TestA,并恢复到到hostB机中 ......

mysql 乱码问题。

show variables like 'character%';查看字符编码
--更改字符集
SET character_set_client = utf-8 ;
SET character_set_connection = utf-8 ;
SET character_set_database = utf-8 ;
SET character_set_results = utf-8 ;
SET character_set_server = utf-8 ;
SET collation_connection = utf8 ;
SET colla ......

MySQL 5.1.42 发布

MySQL 5.1 是 MySQL 数据库目前发布的最新的稳定版本(5.5是beta状态,6.0是alpha状态)。
该版本增加了对下面几个平台的支持:
Mac OS X 10.6 x86/x64
HP-UX 11.31 IA64
SLES 11 x86/x64
InnoDB 插件升级到 1.0.6 版本,另外通过对查询缓存的碎片优化提升了性能,更多详细的内容请看这里。
下载地址:http://dev. ......

MYSQL中的 constraint 与 CONSTRAINT

一直习惯使用小写的SQL保留字,没想到今天居然遇到了麻烦哈!!和谐一下MYSQL啦!
环境:Server version: 5.1.37-1ubuntu5 (Ubuntu)
alter table child_table_name
add constraint constraint_name

foreign key (column_1)
references reference_table_name(reference_column_1);

ALTER  TABLE child_t ......

MySQL 一次执行多条语句的实现及常见问题

代码如下:
//链接时设定
mysql_real_connect( ..., CLIENT_MULTI_STATEMENTS );
//或者
//中途指定
mysql_set_server_option( mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON ); //mysql是连接的名称
当使用执行多语句功能后,一定要读完整个resault集,否则会出现错误:Commands out of sync; you can't run this co ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号