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

mysql的一些高级语句

一,今天给大家讲一下,做留言的一种追加的方式主要如果当前有留言,就更新当前的留言以追加的方式,如果没能留言就将入一条新的
mysql:insert into `table` (field) values ('$value') on duplicate key update `field`=concat('value',ifnull(`field`,''));
具体本条SQL的用法,请查看手册
二,讲一下统计的用法,主要介绍如何用一条SQL语句,统计某个用户的某个字段中不同状态的合
首先,(select t.username,t.action,count(*) as num from t group by t.username,t.action) as N用分组的方式将不同的用户中的某个字段的某些状态分组求合这是子句
然后,select N.username,max(CASE N.action where 'field1' then n.num else 0 end) as field1_num,max(CASE N.action where 'field2' then n.num else 0 end) as field2_num from ,(select t.username,t.action,count(*) as num from t group by t.username,t.action) as N group by N.username
然后分别显示username,field1_num,field2_num


相关文档:

mysql 非安装版的一个自动安装脚本

个人劳动,还请尊重,如若转载请注明出处。iihero@CSDN
看到有些朋友老问这个非安装版与安装版有什么区别(当然是windows平台)
干脆写了一个脚本自动为其创建mysql5服务。
脚本如下,将其放到解压以后的目录里边执行即可。
@echo off
echo "This is a demo script for auto installation of noninstall version o ......

在一电脑上安装多mysql实例

我的环境:
原有一mysql5.0实例,现新安装一mysql5.1,并将新的5.1实例的数据路径放在另一目录。
mysql5.1的my.ini如下
(配置my.ini的参考资料:
http://dev.mysql.com/doc/refman/5.1/en/option-files.html
http://downloads.mysql.com/docs/mysql-windows-excerpt-5.1-en.pdf
http://dev.mysql.com/doc/refman/5.0 ......

mysql 时间函数

1.DATE_FORMAT('2010-05-15 15:47:36','%H:%i:%s')   ->       结果:15:47:36
    将日期格式根据条件不同转换成所需要的日期、时间格式
2.timediff('23:40:00', ' 18:30:00')  ->     结果:05:10:00
    ......

查询mysql数据库的大小

(1)INFORMATION_SCHEMA
select (sum(data_length) + sum(index_length))/(1024*1024) from INFORMATION_SCHEMA.`TABLES` where table_schema =  'your_table_schema' and table_name like 'your_table_name';
(2)show table status like '';
try {
Class.forName("com.mysql.jdbc.Driver");
......

mysql字符集问题

MySQL的字符集支持(Character Set Support)有两个方面:
     字符集(Character set)和排序方式(Collation)。
对于字符集的支持细化到四个层次:
     服务器(server),数据库(database),数据表(table)和连接(connection)。
1.MySQL默认字符集
  MySQL对于字符集的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号