

- 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
What happens if I use both G and semicolon (;) termination symbol with a single MySQL statement?
As we know that \G option sends the command to MySQL server for execution and with the help of Semicolon (;) MySQL determines the end of the statement. It is also known that both of them have a different format of the result set.
Now, if we will use both of those in MySQL statement then the output would be produced on the basis that which of them is encountered first by MySQL. For others, MySQL will produce an error. It can be understood with the help of the following example −
mysql> Select CURDATE();\G +------------+ | CURDATE() | +------------+ | 2017-11-06 | +------------+ 1 row in set (0.00 sec) ERROR: No query specified
In the above MySQL statement, we use a semicolon (;) first and then \G option hence we received the output in tabular format. Afterward, MySQL throws an error as we have not specified any query for \G option.
mysql> Select CURDATE()\G; *************************** 1. row *************************** CURDATE(): 2017-11-06 1 row in set (0.00 sec) ERROR: No query specified
In the above MySQL statement, we use \G option first and then a semicolon (;) hence we received the output in vertical format. Afterward, MySQL throws an error as we have not specified any query for semicolon (;).
- Related Questions & Answers
- How can we use both built-in-commands (G & g) and semicolon (;) in a single MySQL statement?
- How can I combine built-in-commands (g and G), used for executing a MySQL statement, with termination symbol semicolon (;) to get output without any error?
- How can we run a MySQL statement without termination semicolon?
- How can I combine the built-in-commands (g and G), used for executing a MySQL statement, with each other?
- What happens with the output of MySQL EXPORT_SET() function if I will skip both 4th and 5th argument i.e. separator and number of bits?
- What happens if I will use integer values as arguments of MySQL LOCATE() function?
- How can I use MySQL IF() function within SELECT statement?
- What happens if I will delete a row from MySQL parent table?
- What happens if I will assign a value to a MySQL user variable using a statement that returns multiple rows?
- What happens if I will prepare the statement with the same name without de-allocating the earlier one?
- Can I use SUM() with IF() in MySQL?
- How to use COUNT() and IF() in a single MySQL query?
- How can I use a SELECT statement as an argument of MySQL IF() function?
- Can we use semicolon as a MySQL DEMILITER?
- What happens if I pass only one argument to the MySQL CONCAT() function?