
- 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
In MySQL, how we can write Multiple-line statement?
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.
- Related Articles
- How can we have multiple virtuals GENERATED COLUMNS in MySQL table with CREATE TABLE statement?
- How can we update columns values on multiple rows with a single MySQL UPDATE statement?
- How can we escape special characters in MySQL statement?
- How can we enter BOOLEAN values in MySQL statement?
- How can we combine multiple print statements per line in Python?
- How can we specify default values in MySQL INSERT statement?
- How can we use SIGNAL statement with MySQL triggers?
- How we have multiple stored GENERATED COLUMNS in MySQL table with CREATE TABLE statement?
- How can we use a MySQL subquery with INSERT statement?
- How can we run a MySQL statement without termination semicolon?
- Can we write any code after throw statement in Java?
- How can we delete multiple rows from a MySQL table?
- How can we write MySQL handler in a stored procedure?
- How can we enter characters as Hexadecimal (HEX) number in MySQL statement?
- How can we enter characters as a BINARY number in MySQL statement?

Advertisements