What is the role of delimiter in MySql? Many may have such doubts. The following describes the role of delimiter in MySql for your reference.
In the mysql tutorial, what role does delimiter play? Many may have such doubts. The following describes the role of delimiter in mysql for your reference.
After mysql exports an SQL statement:
Delimiter $
Drop trigger if exists 'updateegopriceondelete' $
Create
Trigger 'updateegopriceondelete' after delete on 'mermerinfo'
For each row begin
Delete from egoprice where customerid = old. customerid;
End $
Delimiter;
Set the delimiter terminator to "$", and then define it as ";". The default terminator of mysql is ";".
After mysql exports an SQL statement:
Delimiter $ drop trigger if exists 'updateegopriceondelete' $ create trigger 'updateegopriceondelete' after delete on 'mermerinfo' for each row begin delete from egoprice where customerid = old. customerid; end $ delimiter; the delimiter end is set to "$ ",
Then it is defined as ";", and the default end character of mysql is ";".
Explanation:
In fact, it is to tell the mysql interpreter whether the command has ended and whether mysql can be executed.
By default, delimiter is a semicolon ;. In the command line client, if a command line ends with a semicolon,
After you press enter, mysql will execute this command. Enter the following statement.
Mysql> select * from test_table;
Press enter, and mysql will immediately execute the statement.
But sometimes, you don't want mysql to do this. The statement contains a semicolon.
If you try to enter the following statement in the command line client:
1 2 3