Error Code : 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 报错是因为mysql的procedure里面if else语句里面, 用了begin end语句,去掉了就OK了. DELIMITER $$ USE `sportgbmj`$$ DROP PROC…
-- 索引 INDEXCREATE INDEX idx_sname ON student( sname(4)); ALTER TABLE teacher add index idx_tname(tname); DROP INDEX idx_sname on student; -- 视图 VIEWcreate VIEW v_stuAS SELECT sname,degree from student s, score sc where s.sno=sc.sno; SELECT * from v_s…
DROP PROCEDURE IF EXISTS variable_demo; delimiter // CREATE PROCEDURE variable_demo() BEGIN select 'hello world!'; END;// delimiter ; DROP PROCEDURE IF EXISTS demo1; delimiter // CREATE PROCEDURE demo1(IN type int) BEGIN DECLARE c varchar(500); IF ty…
一.MySQL 创建存储过程 "pr_add" 是个简单的 MySQL 存储过程,这个存储过程有两个 int 类型的输入参数 "a"."b",返回这两个参数的和. drop procedure if exists pr_add; -- 计算两个数之和 create procedure pr_add( a int, b int)begin declare c int; if a is null then set a =…