`
outlaw
  • 浏览: 30636 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

用过的mysql命令

阅读更多

set charset GBK

SET NAMES utf8

130:
show processlist;
 kill 837

select * from post p, post_channel pc
where pc.ID=p.cID
and p.replyid is null
and to_days(now())-to_days(p.sendTime)<=1
and pc.typecode='jj'
order by p.visitedCount desc

select distinct pc.ID
from post_channel pc,post_channelinfo pcinfo, post p, postinfo pinfo
where p.cid=405 and pinfo.postid=p.id and
(pcinfo.UID=pinfo.uid or pcinfo.uid=p.sender) AND
pc.id=pcinfo.POST_CHANNEL_ID and pc.LOGOPATH is not null

 explain
select distinct p.*
from production p,production_remark pr
where p.status=1 and p.deleted=0 and pr.pid=4177
and p.id!=4177 and p.type=3
 and p.sender in (pr.remarkerid,781)

select * from production p where
p.sender=133 and p.status=1

select * from post p where p.replyid is null and p.sender=5816

select * from user u where u.id=1650

update Evaluation e set e.Rating1=round(7*rand()) where e.productionid<1000

call handlerdemo(8933)
DROP PROCEDURE IF EXISTS handlerdemo;
CREATE PROCEDURE handlerdemo (in pid INT)
begin
DECLARE done INT DEFAULT 0;
declare tmp DATETIME;
declare rtime DATETIME;
declare rid INT;
declare cur_tbl cursor for select sr.id,sr.regTime from survey_result sr where sr.productionid=pid;
select p.sendTime into tmp from production p where p.id=pid;
open cur_tbl;
repeat
fetch cur_tbl into rid,rtime;
IF NOT done THEN
set tmp=addtime(tmp,concat('0 0:0:',cast(round(7*rand()+10) as CHAR)));
update survey_result sr set sr.regTime=tmp where sr.id=rid;
end if;
until done end REPEAT;
close cur_tbl;
end;

select count(*) as col_0_0_ from post post0_, post_channel postchanne1_, postinfo postinfo2_ where post0_.ID=postinfo2_.POSTID and postchanne1_.statuses=2 and postchanne1_.ID=post0_.CID and (post0_.REPLYID is null) and to_days(now())-to_days(postinfo2_.VISITTIME)<=1 group by postinfo2_.POSTID
 
select p.* from post p, post_channel pc
where pc.statuses=2 and p.replyid is null and p.cid=pc.id
order by p.replyCount+p.visitedCount desc

select * from user u where u.username like '灰狼太岁'

select pinfo.brandid,count(*) from production p, production_info pinfo
where pinfo.productionid=p.id and p.type=6
--and pinfo.brandid=1
group by pinfo.brandid order by pinfo.brandid

select pc.id,count(*) from production p,production_info pinfo,production pc
where pinfo.productionid=p.id and  p.type=11 and p.aid=369
and pc.id=pinfo.brandid
group by pinfo.brandid

select ep.id,u.username,e.prizename,u.realname,u.address,u.postcode,
u.phone,u.mobile,ep.ext_date
from ext_prize ep, user u,encash e
where u.id=ep.userid and ep.prizeid=e.id and ep.status=0

select * from ext_prize ep,encash e,user u
where ep.prizeid=e.id and ep.userid=u.id and ep.status=0

select distinct admin_id from post_channel_admin pca
where pca.admin_id not in (select u.id from user u)

select vp.*,u.username from vote_production vp,user u
where vp.uid=u.id and vp.productionid=15751

 

250:
insert dict (keyword)
select concat('wl',substr(keyword,3,15)) as keyword from dict where keyword like 'cd_post_%'

 select * from post p, post_channel pc
 where p.cid =pc.id and
   pc.code like 'cX%'
 
  select * from post p
 where p.cid in
  ( select pc.id from post_channel pc
  where pc.code like '%cx%') order by id desc
 
select post.title,post.sendTime,post.senderName,pc.name
from post,post_channel pc
where post.cid=pc.id and post.sender=1629

select  count(*)
from production p
where p.sender=1667
and DATE(p.sendTime)>(ADDDATE(CURRENT_DATE(), INTERVAL -1 DAY))
and DATE(p.sendTime)<(ADDDATE(CURRENT_DATE(), INTERVAL 1 DAY))

select p.*  from production p,production_info pInfo, Evaluation e
where p.id=pInfo.productionid and p.id=e.productionid
and p.status=1 and p.deleted=0 and p.type=3  
order by (e.rating1+e.rating2+e.rating3+e.rating4+e.rating5+p.visitedcount+p.remarkedcount)  desc

select * from production p,production_info pinfo,brand b
where p.id=pinfo.productionid and pinfo.brandid=b.id and
p.type=3 and p.STATUS=1 and p.deleted=0
and (p.title like '%a%' or p.label like '%a%' or p.remark like '%a%' or b.name like '%a%')

select distinct p.id from post p,postinfo p1,postinfo p2
where p.id=p1.postid and p1.uid=p2.uid and p2.postid=1
and p.id<>1 and p.replyid is null

select * from post_channelinfo p
where TO_DAYS(NOW()) - TO_DAYS(p.jointime) <= 7
group by p.post_channel_id
order by count(*) desc

select distinct pci.post_channel_id from post_channelinfo  pci,postinfo pinfo
where pci.uid=pinfo.uid and pinfo.postid=119


select pc.* from post_channel pc where pc.id in (
select pcinfo.post_channel_id from post_channelinfo pcinfo
where  pcinfo.uid in (select p.sender from post p where p.cid=21)
or pcinfo.uid in
(select pinfo.uid from post p,postinfo pinfo where p.id=pinfo.postid and p.cid=21)
)


select distinct pc.* from post_channel pc,post_channelinfo pcinfo
where pc.id=pcinfo.post_channel_id
and (pcinfo.uid in (select p.sender from post p where p.cid=21)
or pcinfo.uid in (select pinfo.uid from post p,postinfo pinfo where p.id=pinfo.postid and p.cid=21))


select * from post_channel postchanne0_, post_channelinfo post_chann1_ where postchanne0_.ID=post_chann1_.POST_CHANNEL_ID and (post_chann1_.UID in (select post2_.SENDER from post post2_ where post2_.CID=21) or post_chann1_.UID in (select postinfo4_.UID from post post3_, postinfo postinfo4_ where post3_.ID=postinfo4_.POSTID and post3_.CID=21)) limit ?


select p from Post p where p.id in (
select distinct p1.postid from Postinfo p1,Postinfo p2
where p1.uid=p2.uid and p2.postid= ? and p.replyid is null) and p.id<> ?


select p.sender,p.cid from post p
group by p.sender,p.cid

select u.* from post_channel_admin pca,user u where pca.admin_id=u.id and channel_id=397

select p.sendTime from production p
where (p.sendTime)>CONVERT('2008-04-20 16:00:00',DATETIME,'yyyy-MM-dd hh:mm:ss')

select cast(a.createTime as CHAR) from activity a

select * from tmp_release_account p where p.release_time like '2008-05-17%'

select * from post p,post_channel pc where p.cid=pc.id and pc.typeCode='jj' limit 10


show processlist;

select * from post post0_, post_channel postchanne1_
where postchanne1_.typeCode='jj'
and postchanne1_.ID=post0_.CID
and (post0_.REPLYID is null)
and to_days(now())-to_days(post0_.SENDTIME)<=1
order by post0_.VISITEDCOUNT desc

 

select pinfo.brandid, SUM(sa.score>0),COUNT(*)
from production p,
production_info pinfo,
survey_result sr,
survey_answer sa,
survey_questions sq

where
p.id=pinfo.productionid and p.type=6 and p.id=sr.productionid
and sq.id=718
and sq.id=sa.questionid
and sr.answerid=sa.id
--and sa.score>0
group by pinfo.brandid


select distinct production0_.id
 from production production0_, production_remark production1_
where production0_.type=3 and production0_.STATUS=1
and production0_.deleted=0 and (production0_.SENDER=production1_.REMARKERID
and production1_.PID=7640 or production0_.SENDER=1667) and production0_.ID<>7640

select distinct production0_.ID,production0_.type
 from production production0_, production_remark production1_
 where --production0_.type=3 and
 production0_.STATUS=1
 and production0_.deleted=0
 and (production0_.SENDER=production1_.REMARKERID and production1_.PID=4177
 or production0_.SENDER=781)
 and production0_.ID<>4177

 

 

call handlerdemo ();
DROP PROCEDURE IF EXISTS handlerdemo;
CREATE PROCEDURE handlerdemo ()
begin
DECLARE done INT DEFAULT 0;
DECLARE num INT DEFAULT 1;
declare tmp DATETIME;
declare rtime DATETIME;
declare rid INT;
declare cur_tbl cursor for select sr.id,sr.regTime from survey_result sr where sr.productionid=8901;

select p.sendTime into tmp from production p where p.id=8901;

open cur_tbl;
repeat
fetch cur_tbl into rid,rtime;
IF NOT done THEN

set tmp=addtime(tmp,'0 0:0:30');
update survey_result sr set sr.regTime=tmp where sr.id=rid;

set num=num+1;
end if;
until done end REPEAT;
close cur_tbl;
select num;
end;

select p.sendTime from production p where p.id=8901;
--select rid,addtime(rtime,'0 0:0:30');

update post_channel pc set pc.ishot=1


select * from production p, production_info pinfo, brand b,
post_channel pc, post_channel_ext pce
where pc.id=pce.post_channel_id and b.name=pc.name and p.id=pinfo.productionid
and p.type=9 and p.status=1 and p.deleted=0 and p.sender=pce.shopManId

select * from production p where p.type=9


select address
from user user0_ where user0_.username ='test'

select *
from production production0_, production_info production1_
where production1_.productionid=production0_.ID
and production1_.brandid=12678 and production0_.STATUS=1
and production0_.deleted=0
order by production0_.ID

select count(apc.category_name) as aaa,apc.category_name
from ask_problem_category apc where lenapc.parent_id
group by apc.category_name order by aaa desc

select * from  ask_problem_category apc where apc.parent_id=165

 

stop slave;

set GLOBAL SQL_SLAVE_SKIP_COUNTER=1;

start slave;


select UNIX_TIMESTAMP('2010-8-16 15:37')

select FROM_UNIXTIME( 1156219870 ,'%y-%M-%d %H:%m:%s' )

SELECT AUTO_INCREMENT FROM information_schema.tables WHERE table_name = 'cdb_uc_members';

alter table `cdb_uc_members` AUTO_INCREMENT=193

SET FOREIGN_KEY_CHECKS=0;

分享到:
评论

相关推荐

    Mysql命令大全 Mysql命令大全

    Mysql 命令大全 Mysql 命令大全是 Mysql 数据库管理系统中的一些常用命令的汇总,涵盖了连接 Mysql、修改密码、增加新用户、操作数据库等多方面的内容。下面是对这些命令的详细说明: 一、连接 Mysql 连接 Mysql ...

    常用的MySQL命令大全.pdf

    常用的 MySQL命令大全 一、连接 MySQL 格式: mysql -h 主机地址 -u 用户名 -p 用户密码 1、例 1:连接到本机上的 MYSQL 。 首先在打开 DOS窗口,然后进入目录 mysqlbin ,再键入命令 mysql -uroot -p ,回车后...

    linux 服务安装mysql命令

    本文将详细介绍如何安装 MySQL 服务器,包括安装、设置开机启动、启动服务、设置 root 用户密码、基本命令使用等步骤。 安装 MySQL 首先,我们需要使用 yum 安装 MySQL 服务器。打开 Terminal,输入以下命令: ...

    MySql命令帮助文档

    ### MySQL命令帮助文档知识点解析 #### 一、启动MySQL服务器 **知识点1:启动方法** - **使用winmysqladmin工具**:这是一种图形化的工具,可以在系统启动时自动运行MySQL服务,便于管理和监控MySQL服务器的状态...

    MySQL数据库命令大全

    ### MySQL数据库命令详解 #### 一、MySQL服务的管理 MySQL作为一款广泛使用的开源关系型数据库...以上是MySQL数据库中常见的命令操作,熟练掌握这些命令能够帮助数据库管理员或开发者更高效地管理和使用MySQL数据库。

    mysql命令 基本命令

    以下是一些基本的MySQL命令,涵盖了从建立数据库到执行简单操作的过程。 1. **连接MySQL服务器**: 使用`mysql -u &lt;username&gt; -p`命令连接到MySQL服务器,其中`&lt;username&gt;`是你的用户名。系统会提示输入密码,输入...

    mysql命令大全.docx

    本文档旨在提供一个完整的 MySQL 命令大全,帮助用户快速掌握 MySQL 的使用和管理。 一、MySQL 登录命令 MySQL 登录命令的格式为:mysql -h 主机地址 -u 用户名 -p 用户密码。例如,要连接到远程主机的 MySQL ...

    常见mysql命令总结

    ### 常见MySQL命令总结 #### 数据库备份与恢复 **导出整个数据库** - **命令**: `mysqldump -u 用户名 -p --default-character-set=latin1 数据库名 &gt; 导出的文件名` - **示例**: `mysqldump -u wcnc -p smgp_...

    常用mysql命令大全_mysql快速上手

    如果你要连接到远程主机上的 MySQL,假设远程主机的 IP 地址为 110.110.110.110,用户名为 root,密码为 abcd123,可以使用以下命令:`mysql -h110.110.110.110 -uroot -pabcd123` 退出 MySQL 要退出 MySQL,可以...

    mysql+php+iis配置+mysql命令

    标题中的“mysql+php+iis配置+mysql命令”表示我们需要探讨如何在Windows环境下,通过IIS(Internet Information Services)Web服务器来配置PHP和MySQL服务,并掌握一些基本的MySQL命令。 一、MySQL配置与管理 ...

    mysql命令大全(最全面)

    要连接到 MySQL,需要使用以下命令: ``` mysql -h 主机地址 -u 用户名 -p 用户密码 ``` 其中,`-h` 选项指定了 MySQL 服务器的主机地址,`-u` 选项指定了用户名,`-p` 选项指定了用户密码。 例如,要连接到本机上...

    mysql命令大全,mysql5命令大全

    1. **本地连接**:在 DOS 环境下,可以使用 `mysql` 命令来连接 MySQL 服务器。例如,如果服务器安装在本地,并且用户名为 root,可以通过以下命令连接: ```bash mysql -h localhost -u root -p ``` 输入该命令...

    常见的MySQL命令大全.doc

    下面将详细介绍在MySQL中常用的命令。 1. **连接MySQL** - `mysql -h 主机地址 -u 用户名 -p 用户密码` - 连接到本地MySQL服务器时,只需输入`mysql -u root -p`,如果初始未设置密码,则直接回车即可。 - 连接...

    CentOS MySQL启动和关闭命令

    启动MySQL服务时使用的命令为`/usr/local/mysql/share/mysql/mysql.server start`。这个命令实际上是调用了`mysql.server`脚本,该脚本负责初始化MySQL服务,并启动MySQL守护进程。 - **命令格式**:`/usr/local/...

    mysql常用操作命令

    mysql的备份可以使用mysqldump命令,例如mysqldump -uroot -p mysql &gt; c:\mysql.sql命令可以将mysql数据库备份到c:\mysql.sql文件中。恢复mysql数据库可以使用mysql -u root mysql &lt; c:\mysql.sql命令。 掌握mysql...

    mysql命令集

    ### MySQL命令集详解 #### 一、MySQL服务管理命令 **1. 启动MySQL服务** - 使用`mysqladmin start`命令启动MySQL服务。 - 如果安装了MySQL的初始化脚本,则可以通过 `/etc/init.d/mysql start` 命令来启动MySQL...

    MySQL命令.docx

    你可以使用`CREATE USER`命令创建新用户,例如`CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';`。这里的`localhost`可以替换为IP或机器名称,`%`表示允许任何地址的主机远程登录。若要删除用户,...

Global site tag (gtag.js) - Google Analytics