step1:在mysql cmd中新建存储过程: drop procedure if exists queryCountByGrade ; delimiter // -- 定义存储过程结束符号为// create procedure queryCountByGrade(IN gradenameinput INT(),OUT counts ) begin select count(*) into counts from student where grade = gradenameinput;en
可以用 命令"show PROCEDURE status"查看所有的存储过程或检索系统表"mysql.proc"来查询已有的存储过程.例如:用show PROCEDURE status命令查看:-- 查看所有的存储过程show PROCEDURE status; -- 查看特定数据库存储过程show PROCEDURE status where db='test'; -- 用指定的登录名查看该用户创建的存储过程show PROCEDURE status where
mysql in 子查询 效率慢 优化(转) 现在的CMS系统.博客系统.BBS等都喜欢使用标签tag作交叉链接,因此我也尝鲜用了下.但用了后发现我想查询某个tag的文章列表时速度很慢,达到5秒之久!百思不解(后来终于解决),我的表结构是下面这样的,文章只有690篇. 文章表article(id,title,content)标签表tag(tid,tag_name)标签文章中间表article_tag(id,tag_id,article_id)其中有个标签的tid是135,我帮查询标签tid是13