mysql----函数

Posted 山上有风景

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql----函数相关的知识,希望对你有一定的参考价值。

自带函数

自定义函数

创建函数‘’
delimiter \\\\
create function f1(
    i1 int,
    i2 int)
returns int
begin
    declare num int;
    set num = i1 + i2;
    return(num)
end \\\\
delimiter ;

删除函数‘’
drop function f2

执行函数
1.直接获取
select f1(11, id),name from info;
2.放到变量中
declare @i1 int
select f1(11,12) into @i1
select @i1

 

以上是关于mysql----函数的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段——声明函数

VSCode自定义代码片段8——声明函数

部分代码片段

从mysql的片段中加载ListView

连接MySQL出现错误:ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES)(代码片段

使用从循环内的代码片段中提取的函数避免代码冗余/计算开销