Mysql基礎存儲過程
#查詢表 user select * from user #刪除seleUser()存儲過程 drop procedure if exists seleUser; **#查詢全部** create procedure seleUser() begin select * from `user`; end;; call seleUser(); #刪除seleUserId() drop procedure if exists seleUserId; **#根據id查詢** create procedure seleUserId(in id INTEGER) begin select * from `user` where uid = id; end;; call seleUserId(1); drop procedure if exists login; **#判斷是否存在 返回count(*)** create procedure login(in NewAccount varchar(50),in NewPwd varchar(50)) begin select count(*) from `user` where account = NewAccount and pwd = NewPwd; end;; call login('404','123'); #刪除addUser()存儲過程 drop procedure if exists addUser; **#新增** create procedure addUser(in NewUname varchar(50),in NewAccount varchar(50),in NewPwd varchar(50),in NewSex char(2)) begin insert into user(uname,account,pwd,sex)value(NewUname,NewAccount,NewPwd,NewSex); end;; call addUser('王五','wangW','111','女'); drop procedure if exists deleIdUser; **#根據id刪除** create procedure deleIdUser(in NewUid INTEGER) begin DELETE from user where uid = NewUid; end;; call deleIdUser(2); drop procedure if exists uptIdUser; **#根據id修改** create procedure uptIdUser(in NewUid int,in NewUname varchar(50),in NewAccount varchar(50),in NewPwd varchar(50),in NewSex char(2)) begin UPDATE user set uname=NewUname,account=NewAccount,pwd=NewPwd,sex=NewSex where uid = NewUid; end;; call uptIdUser(3,'小花','Xhua','123456','女');
**javascript
不喜勿噴 謝謝你們了
**java