实例1:
为了演示MySQL中的存储过程,我们先创建一些表和数据:
drop table if exists my_test_table;
create table my_test_table (...('陈绮贞',,10.0),
('朴树',,12.0),('谢天笑',,10.0),('谢春花',,10.0),('房东的猫',,100.0),('许巍',,10.0);
然后创建一个空参数的存储过程...test_procedure1()
begin
select avg(point) as pointaverage
from my_test_table;
end //
delimiter ;
然后运行这个存储过程...:
call test_procedure1()
可以看到结果如下:
pointaverage|
------------|
24.2|
删除存储过程:
drop procedure test_procedure1