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

mysql 5.0存储过程学习总结

 
mysql 5.0存储过程学习总结
一.创建存储过程
1.基本语法:
create procedure
sp_name()
begin
………
end
2.参数传递
二.调用存储过程
1.基本语法:call
sp_name()
注意:存储过程名称后面必须加括号,哪怕该存储过程没有参数传递
三.删除存储过程
1.基本语法:
drop procedure
sp_name//
2.注意事项
(1)不能在一个存储过程中删除另一个存储过程,只能调用另一个存储过程
四.区块,条件,循环
1.区块定义,常用
begin
……
end;
也可以给区块起别名,如:
lable:begin
………..
end
lable;
可以用leave lable;跳出区块,执行区块以后的代码
2.条件语句
if
 条件 
then
statement
else
statement
end
 
if
;
3.循环语句
(1).while循环
[
label:
]
 
WHILE
 expression DO
statements
END
 
WHILE
 
[
label
]
 ;
(2).loop循环
[
label:
]
 LOOP
statements
END
 LOOP 
[
label
]
;
(3).repeat until循环
[
label:
]
 REPEAT
statements
UNTIL expression
END
 REPEAT 
[
label
]
 ;
五.其他常用命令
1.show procedure
status
显示数据库中所有存储的存储过程基本信息,包括所属数据库,存储过程名称,创建时间等
2.show create procedure
sp_name
显示某一个存储过程的详细信息
mysql存储过程中要用到的运算符
mysql存储过程学习总结-操作符
算术运算符
+     加   SET var1=2+2;       4
-     减   SET
var2=3-2;       1
*     乘   SET var3=3*2;       6
/     除   SET
var4=10/3;      3.3333
DIV   整除 SET var5=10 DIV 3;  3
%     取模 SET
var6=10%3 ;     1
比较运算符
>           
大于 1>2 False
<        &n


相关文档:

MySql常用命令

  启动:net start mySql;
  进入:mysql -u root -p/mysql -h localhost -u root -p databaseName;
  列出数据库:show databases;
  选择数据库:use databaseName;
  列出表格:show tables;
  显示表格列的属性:show columns from tableName;
  建立数据库:source fileNa ......

.\mysql\user is marked as crashed 解决办法

 
I found a solution to anyone else who may be having this problem.
First start mysql using skip grant tables
root@ns1 [/var/lib/mysql/mysql]# service mysql start --skip-grant-tables
Starting MySQL [ OK ]
now with mysql started, you can repair the mysql/user table
root@ns1 [/var/lib/mysql ......

linux c++连接mysql示例

 
 编译和连接程序
  MySQL中有一个特殊的脚本,叫做mysql_config. 它会为你编译MySQL客户端,并连接到MySQL服务器提供有用的信息.你需要使用下面两个选项.
  1. --libs 选项 - 连接MySQL客户端函数库所需要的库和选项.
  $ mysql_config --libs
  2. --cflags 选项 - 使用必要的include文件的选项等等.
......

java(jsp)使用MySql数据库,中文乱码的完整解决方案

 java(jsp)使用MySql数据库,中文乱码的完整解决方案
mysql是一个小型的开源的数据库,用来自学一些技术是十分方便的。但使用mysql存储数据,也会遇到一些非常恶心的问题,如:中文乱码问题、java驱动程序无法使用的问题(已经解决,详见:http://hi.baidu.com/lauo1988/blog/item/ff0da655bd3e2eceb745ae0b.html)。 ......

远程连接mysql

解决方法(转):---但执行第一种办法时出现错误,第二种办法成功
1。改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
mysql -u root -pvmwaremysql>use mysql;mysql>update use ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号