- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How does MySQL determine the end of the statement?
MySQL determines the end of a statement when it encounters any one of the followings −
Semicolon(;)
Generally, MySQL determines the end of the statement, single-line or multiple-line, when it encounters the termination semicolon(;). Consider the examples below,
mysql> Select * from employee; (Single line statement) mysql> Select * -> from -> employee; (Multiple line statement)
In both cases, MySQL returns the result set after encountering the semicolon, which means the end of the statement.
\G option
\G option means to send the current state to the server to be executed and display the result in a vertical format. When we use \G and omitting semicolon(;) in a statement (single or multiple lines), MySQL determines the end of the statement as and when it encounters \G. Consider the example below −
mysql> Select * from Student\G *************************** 1. row *************************** Name: Gaurav RollNo: 100 Grade: B.tech *************************** 2. row *************************** Name: Aarav RollNo: 150 Grade: M.SC *************************** 3. row *************************** Name: Aryan RollNo: 165 Grade: M.tech 3 rows in set (0.00 sec)
\g option
\g option means to send the current state to the server to be executed. When we use \g and omitting semicolon(;) in a statement (single or multiple lines), MySQL determines the end of the statement as and when it encounters \g. It gives the output in the same format as we get by using a semicolon (;). Consider the example below −
mysql> Select * from Student\g +--------+--------+--------+ | Name | RollNo | Grade | +--------+--------+--------+ | Gaurav | 100 | B.tech | | Aarav | 150 | M.SC | | Aryan | 165 | M.tech | +--------+--------+--------+ 3 rows in set (0.00 sec)
- Related Articles
- How to correctly implement END IF statement in a MySQL Stored Procedure?
- Add a percentage (%) sign at the end to each value while using MySQL SELECT statement
- How to determine the current delimiter in MySQL?
- How does WhatsApp “End-End Encryption” Feature Keeps data Safe?
- What does the .end() function do in jQuery?
- What does a “set+0” in a MySQL statement do?
- How MySQL evaluates the statement written on different lines?
- Why does Python allow commas at the end of lists and tuples?
- How to sort a particular value at the end in MySQL?
- What is the use of MySQL IGNORE INSERT statement?
- How ANALYZE TABLE statement helps in maintaining the MySQL tables?
- How does a boat move forward into the water when the boatman presses one end of the pole against the ground?
- How can we discard a MySQL statement in the middle of its processing?
- How can I see the CREATE TABLE statement of an existing MySQL table?
- How can I get the information about a particular column of a table by MySQL EXPLAIN statement? EXPLAIN statement?
