mysql 5.0使用_mysql5.0使用总结

创建表,以及表之间的关系use test;create table person(id smallint unsigned not null auto_increment,name char(40) not null,primary key(id));create table shirt(id smallint unsigned not null auto_increment,style enum...
摘要由CSDN通过智能技术生成

创建表,以及表之间的关系

use test;

create table person(

id smallint unsigned not null auto_increment,

name char(40) not null,

primary key(id));

create table shirt(

id smallint unsigned not null auto_increment,

style enum('t-shirt','polo','dress') not null,

color enum('red','blue','orange') not null,

owner smallint unsigned not null references person(id),

primary key(id));

创建视图

create view skirt_view as

select person.id as id,person.name as name,shirt.style as style,shirt.color as color from person,shirt

where person.id=shirt.owner;

创建用户

grant all privileges on *.* to 'money2'@'%' identified by 'panjun2' with grant option;

grant all privileges on *.* to 'money2'@'localhost' identified by 'panjun2' with grant option;

创建存储过程以及函数

格式:

CREATE PROCEDURE 过程名 ([过程参数[,...]])

[特性 ...] 过程体

CREATE FUNCTION 函数名 ([函数参数[,...]])

RETURNS 返回类型

[特性 ...] 函数体

过程参数:

[ IN | OUT | INOUT ] 参数名 参数类型

函数参数:

参数名 参数类型

返回类型:

有效的MySQL数据类型即可

过程体/函数体:格式如下:

BEGIN

有效的SQL语句

END

在开发过程中有几点要注意:

1、存储过程注释

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值