sql存储过程
存储过程就是数据库sql语言层面的封装和复用。
基本语法:
#创建存储过程
create procedure p1()
beginselect count(*) from user;
end;#调用存储过程call p1();#查看test数据库下存储过程select * from information_schema.ROUTINES where ROUTINE_SCHEMA = 'test'
#查看存储过程创建语句
show create procedure p1;#删除存储过程
drop procedure if exists p1;