How to change MySQL ending statement?

MySQLMySQLi Database

To change the MySQL ending statement, you can use DELIMITER −

DELIMITER anySymbol

Above, anySymbol is the symbol you can set. The default is DELIMITER ;

Let us first create a table −

mysql> DELIMITER //
mysql> create table DemoTable
   -> (
   -> Id int,
   -> Name varchar(20)
   -> )//
Query OK, 0 rows affected (0.52 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable values(100,'Chris')//
Query OK, 1 row affected (0.21 sec)
mysql> insert into DemoTable values(101,'David')//
Query OK, 1 row affected (0.16 sec)
mysql> insert into DemoTable values(102,'Bob')//
Query OK, 1 row affected (1.07 sec)

Display all records from the table using select statement −

mysql> select * from DemoTable //

This will produce the following output −

+------+-------+
|   Id | Name  |
+------+-------+
|  100 | Chris |
|  101 | David |
|  102 | Bob   |
+------+-------+
3 rows in set (0.00 sec)
raja
Published on 18-Dec-2019 06:03:46
Advertisements