MySQL 开发
mysqldbd
这个作者很懒,什么都没留下…
展开
-
Control Flow Functions!
<br />1 CASE ... WHEN ... THEN ... SLSE END.mysql> SELECT CASE 1 WHEN 1 THEN 'one' -> WHEN 2 THEN 'two' ELSE 'more' END; -> 'one'mysql> SELECT CASE WHEN 1>0 THEN 'true' ELSE 'false' END; -> 'true'mysql> SELECT CASE BINARY '原创 2010-12-02 16:08:00 · 418 阅读 · 0 评论 -
MySQL开启事务的sql块的写法!
<br />DELIMITER $$<br />use test$$<br />drop procedure if exists test.t1$$<br />use `test` $$<br />create procedure test.t1()<br />begin<br /> drop table if exists t1;<br /> create table test.t1 (c1 int)<br /> ENGINE = InnoDB;<br /> <br />原创 2011-01-21 18:25:00 · 22425 阅读 · 0 评论 -
MySQL中详细update (on duplicate key update id=values(id),value=values(value)......)
<br />use test;<br />drop table if exists test.test;<br />CREATE TABLE `test` (<br /> `id` tinyint(4) NOT NULL,<br /> `value` varchar(10) NOT NULL,<br /> PRIMARY KEY (`id`)<br />) ENGINE=MyISAM DEFAULT CHARSET=utf8;<br />insert into test.test(id,value)原创 2011-01-14 09:56:00 · 8825 阅读 · 0 评论 -
MySQL全文检索学习!
<br />-- 需要在my.cnf里面设置一个参数<br /># full text param init<br />ft_min_word_len=1<br />use test;<br />drop table if exists tnew;<br />CREATE TABLE `tnew` (<br />`id` int NOT NULL primary key ,<br />`content` longtext ,<br />FULLTEXT INDEX `content` (`conten原创 2011-01-12 18:04:00 · 1652 阅读 · 1 评论 -
mysql分组排序取前N条记录的最简洁的单条sql !
<br />-- mysql分组排序取前N条记录的最简洁的单条sql。<br />use test;<br />drop table if exists test;<br />create table test (<br /> id int primary key,<br /> cid int,<br /> author varchar(30)<br />) engine=myisam;<br />insert into test values <br />(1,1,'test1'),<br />(原创 2011-01-12 14:29:00 · 2056 阅读 · 0 评论 -
mysql分组排序取前N条记录的最简洁的单条sql
<br />-- mysql分组排序取前N条记录的最简洁的单条sql。<br />use test;<br />drop table if exists test;<br />create table test (<br /> id int primary key,<br /> cid int,<br /> author varchar(30)<br />) engine=myisam;<br />insert into test values <br />(1,1,'test1'),<br />(原创 2011-01-12 18:04:00 · 1893 阅读 · 0 评论 -
MySQL 主从复制 replication 实验!
<br /> <br />【备注】: <br />主机 192.168.250.20<br />备机 192.168.250.40<br />主从复制<br />1 主机上面已经有了MySQL5.1.53-log版.<br />2 备机上没有mysql数据库,需要在备机上安装MySQL5.1.53-log软件,具体参考svn文档“system/mysql/document/IT_SYS_MySQL_Installation.docx”。<br />3 再次确定主服务器与从服务器的MySQL版本一致<br /原创 2011-01-05 18:16:00 · 1383 阅读 · 0 评论 -
Mysql日志简介
Mysql 一共记录 4 种日志1. The Error Log2. The General Query Log3. The Binary Log4. The Slow Query Log从MySQL5.1.6开始,General Query Log和Slow Query Log开始可以写到文件或者数据库表中,并且日志的开关,保存方式的修改,都是Global级别动态修改。也就是说不需要重启服务器动态生效了。日志保存到数据库表root@mysql-server>SET GLOBAL log_output=TA转载 2011-01-05 18:15:00 · 3122 阅读 · 0 评论 -
MySQL日志
<br />Mysql 一共记录 4 种日志<br />1. The Error Log<br />2. The General Query Log<br />3. The Binary Log<br />4. The Slow Query Log<br />从MySQL5.1.6开始,General Query Log和Slow Query Log开始可以写到文件或者数据库表中,并且日志的开关,保存方式的修改,都是Global级别动态修改。<br />也就是说不需要重启服务器动态生效了。<br />日志保原创 2011-01-02 20:02:00 · 1904 阅读 · 0 评论 -
id分组查询取最新的一条!
<br />select max(id), c2,c3,c4 from tb1 group by id order by insert_time asc;<br /> <br />【】id为自增。原创 2010-12-15 09:38:00 · 549 阅读 · 0 评论 -
MySQL While 循环小例子
<br />-- MySQL While循环例子<br /> delimiter $$<br />create procedure p_file_t()<br />begin<br /> declare a int;<br /> set a=1;<br /> loop1:while a<3 do<br /> insert into drbd_t(hash,path) values('abcd123456', '/192.168.250.100/file');<br />原创 2011-02-25 14:32:00 · 5539 阅读 · 0 评论