Mysql database study notes

 1 is a database trigger qi https://www.cnblogs.com/phpper/p/7587031.html

① By default, delimiter ";" to submit queries to MySQL. During storage at the end of each SQL statement has a ";" if this time, every ";" submitted to MySQL, then, of course, a problem. Then change the MySQL delimiter.

②show triggers View all flip-flops

③drop trigger trigger_name; remove a trigger.

2, the database stored procedures https://www.cnblogs.com/mark-chan/p/5384139.html .

① are used to access mssql server, probably when using N records before mysql query, accustomed to the use of select top n the form of statements explain here, mysql without this grammar, mysql to carry out their functions with the limit, but also functions more powerful

eg: select * from student limit 0,15 (Select the previous 15)

② The results will be stored in the select statement to the variable https://bbs.csdn.net/topics/310205980

③ added before MySQL stored procedure variable @ symbol represents the session variable scoping is the current login account variables DECLARE declared valid only within the stored procedure.

④ if-then-end statement format:

BEGIN 
if (条件)
    then
        ......
end if;
END
    

declare variables can not be declared inside an if statement

2, database event https://www.jb51.net/article/83430.htm

① timed events do one of the reasons for the success is not possible because the trigger associated with execution error. If you timed event calls a function, this time we must try to run it.

 

 

Guess you like

Origin blog.csdn.net/sinat_38439143/article/details/83246929