

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
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 Questions & Answers
- How to determine the current delimiter in MySQL?
- What does the .end() function do in jQuery?
- 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
- Why does the JavaScript void statement evaluate an expression?
- How does WhatsApp “End-End Encryption” Feature Keeps data Safe?
- What is the use of MySQL IGNORE INSERT statement?
- How to determine the Cost of Capital of a project?
- How MySQL evaluates the statement written on different lines?
- How to determine the efficiency of an Induction Motor?
- How to determine the version of the C++ standard used by the compiler?
- Using the value of an alias inside the same MySQL SELECT statement
- How does mobile safari determine when to prompt the user to share location in HTML?
- How does the Q-table help determine the next action for the ‘agent’ in terms of reinforcement learning in Machine Learning?
- What is the use of FLUSH PRIVILEGES statement in MySQL?