Syntax error How MySQL evaluates the statement written on different lines?

How MySQL evaluates the statement written on different lines?



Actually, MySQL determines the end of the statement when it got termination semicolon. Suppose if we are writing a single statement in different lines then after writing the first line, MySQL changes promptly from ‘mysql>’ to ‘->’ which indicates that MySQL has not seen a complete statement yet and is waiting for the rest. When it got semicolon then MySQL executes the statement. It can be understood with the help of the following example −

Example

mysql> Select Id, Name
    -> From
    -> Student_info
    -> ;

+------+---------+
| Id   | Name    |
+------+---------+
| 101  | YashPal |
| 105  | Gaurav  |
| 125  | Raman   |
| 130  | Ram     |
| 132  | Shyam   |
| 133  | Mohan   |
| 150  | Saurabh |
+------+---------+
7 rows in set (0.07 sec)
Updated on: 2020-06-22T11:53:48+05:30

118 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements