
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Why do we need to change the delimiter for creating a trigger?
As we know that in MySQL we use the delimiter semicolon (;) to end each statement. The semicolon is the by default delimiter in MySQL. We need to change the delimiter, while creating a trigger, to tell MySQL that this is not the end of our trigger statement because we can use multiple statements in the trigger. We can change the delimiter temporarily by DELIMITER // statement to change the delimiter from Semicolon (;) to two back-slash (//). After this MySQL would know that the triggering statement only ends when it encounters a two back-slash (//). Following is an example of changing the delimiter −
mysql> DELIMITER //
Now to end the MySQL statements, the delimiter would be a two back-slash (//). And to change it again to a semicolon(;), we can use the following statement −
mysql> DELIMITER ;
Remember that there must be a space between the keyword DELIMITER and the symbol which we want to use as a delimiter.
- Related Articles
- Why do we need a Database
- What does DELIMITER // do in a Trigger in MySQL?
- Why do we need KDD?
- Why do we need Energy?
- Why do we need to study Physics?
- Why do we need to store food?
- Why do we need Good Manners?
- Why do we need Computer Networks?
- Why do we need shell scripting?
- Why do we need Data Encryption?
- Why do we need a separate Data Warehouse?
- Why We Have a Need for Affection
- Why do we need two muscles to move a bone?
- Why do we need generics in Java?
- Why do we need weakMaps in Javascript?
