The SQL Server database has been used before, and has recently been exposed to MySQL by chance. Here is a summary of the "Create, invoke, delete" Examples of MySQL stored procedures, views
======================================= Stored Procedure ==================================
/* Create a stored procedure */
DELIMITER $$/* To avoid conflicts, first use "DELIMITER &&" to set the MySQL terminator to &&*/
Use ' dataname ' $$/*dataname--> database name */
Drop PROCEDURE if EXISTS ' AA ' $$/* Determine if the stored procedure exists (delete if present) */
CREATE definer= ' root ' @ '% ' PROCEDURE ' AA ' (str_id varchar)/*aa--> stored procedure name; str_id VARCHAR--and parameters */
BEGIN
SELECT * from Tj_archive WHERE id=str_id; /* SQL script executed by */
end$$
DELIMITER; /* Finally re-use "DELIMITER;" To restore the Terminator component number */
/* View Stored procedures */
Call ' AA ' (' D1608220023 ')
/* Delete stored procedures */
DROP PROCEDURE ' AA '
======================================= View ==================================
--Create a view
CREATE VIEW MyView as
SELECT
Case Sex-Applicability 0: Unisex 1: Male 2: Female
When sex= ' man ' then 1--For male
When sex= ' women ' then 2--for women
When sex= ' Universal ' then 0--unisex
END as XB
From MyTable--table
--where--filter conditions
--View View
--select * from MyView
MySQL stored procedures, views---Create, invoke, delete