Stored Procedure Functions
--Set the terminator of the database to///mysql> delimiter///--create process functions testmysql> CREATE PROCEDURE test (a int), Begin, select * from student where id=a; -End-///query OK, 0 rows affected (0.01 sec) mysql> delimiter;--calling function Testmysql> call Test (2); +----+--- ---+-----+-----+| ID | name | Age | Sex |+----+------+-----+-----+| 2 | Lisi | 31 | 0 |+----+------+-----+-----+1 row in Set (0.00 sec) Query OK, 0 rows Affected (0.00 sec)--View status information for function test mysql> Show Procedure status like ' Test ' \g *************************** 1. Row *************************** db:shop name:test type:procedure Definer: [email protected] modified:2018-04-24 12:42:43 created:2018-04-24 12:42:43 Security_type:definer Comment:character_set_client:utf8collation_connection:utf8_general_ci Database C Ollation:utf8_general_ci1 row in Set (0.00 sec)--delete function testmysql> drop proceduRe test;
View
-- 创建视图mysql> create view test_view(name,age) as select name,age from student where id =5;Query OK, 0 rows affected (0.00 sec)-- 视图调用 mysql> select * from test_view;+--------+-----+| name | age |+--------+-----+| tianqi | 42 |+--------+-----+1 row in set (0.01 sec)-- 查看视图的创建过程mysql> show create view test_view \G
mysql-function, view