Mysql delimiter (1/3)

Source: Internet
Author: User
Tags mysql tutorial

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.