mysql面向过程学习

见鬼了,运行的时候就会出问题,什么栈内存不足,我是mac,要改/Etc/my.cnf, 改成256k就够了,直接用vsc编辑器打开吧,vi打开权限不够,改东西还要去查命令行,烦,

然后我tm重启半天,命令行反正我没搞好,直接去偏好设置那里停止,然后启动mysql吧。真坑

mysql面向过程学习
 1 create table People(
 2     id int not null auto_increment,
 3     name varchar(20),
 4     age int,
 5     birthday datetime,
 6         primary key(id)
 7 )ENGINE=InnoDB DEFAULT CHARSET=utf8;
 8 alter table People modify id  auto_increment;
 9 insert into People(name,age,birthday) values('Amanda','1',CURRENT_DATE());
10 insert into People(id,name,age,birthday) values(2,'Balea',18,CURRENT_DATE());
11 
12 create procedure GetPeopleName()
13 begin
14     select name from People;
15 end;
16 --执行
17 call GetPeopleName();
View Code

 

 

mysql面向过程学习
 1 111------cnblogs.com/nananana/p/9675464.html---------------
 2 create table aa(
 3 
 4 CREATE PROCEDURE insert_aa_val(in sum int)
 5 BEGIN
 6 
 7 DECLARE i int default 1;
 8 DECLARE `name` varchar(20) default "a";
 9 DECLARE age varchar(20) default "b";
10 DECLARE sex varchar(20) default "c";
11 
12 WHILE i<= sum do
13 SET `name` = "a";
14 SET age = "b";
15 SET sex = "c"; 
16 INSERT into aa values (null,`name`,age,sex);
17 set i = i + 1;
18 END WHILE;
19  
20 END;
21 call insert_aa_val(3);
View Code

 

上一篇:Linux Shell 变量自加


下一篇:MySQL-存储过程