
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Write Multiple Line Statement in MySQL
We can write multiple-line statements because MySQL determines the end of a statement by looking for the termination semicolon, not by looking for the end of the input line.
Example
mysql> Select * -> from -> stock_item; +------------+-------+----------+ | item_name | Value | Quantity | +------------+-------+----------+ | Calculator | 15 | 89 | | Notebooks | 63 | 40 | | Pencil | 15 | 40 | | Pens | 65 | 32 | | Shirts | 13 | 29 | | Shoes | 15 | 29 | | Trousers | 15 | 29 | +------------+-------+----------+ 7 rows in set (0.00 sec)
In the example above, we write a single query into multiple lines and MySQL returns the output only after getting the termination semicolon. In this way we can also say that MySQL can recognize liberated-format input, it gathers the input lines but does not accomplish them until it notices the termination semicolon.
Advertisements