MySQL基础(3) | 函数


前言

MySQL只有标量值函数的概念,没有SqlServer那种表值函数。

语法

  1. 创建
1
2
3
4
5
6
7
8
9
create function f_add(
	a int,
	b int
)
returns int
return 
	(select a + b);
	
select f_add(1, 2);
  1. 修改
1
alter function f_add()...
  1. 删除
1
DROP FUNCTION [ IF EXISTS ] <>

参考:http://c.biancheng.net/view/2590.html