Sample Header Ad - 728x90

MySQL: Why doesn't the "use" command require ";" to be executed?

5 votes
3 answers
765 views
In MySQL 8 server community edition, here are examples of a _SQL query_ and _command_ in the MySQL Shell:
SELECT * FROM planet;
DESC planet;
SHOW DATABASES;
SHOW tables;
As you can see is **mandatory** to declare the ; character (or either \g or \G according the case) at the end of the sentence. But I did realize by mistake that it is possible to execute the use command to change the database **without** ;. Therefore, the two following commands work in peace:
use 
use ;
Just being curious: **Question** * Why doesn't the use command require ; to be executed? To be honest I am not sure if it is the unique command with this situation but why it is different against others?
Asked by Manuel Jordan (229 rep)
Apr 18, 2025, 04:46 PM
Last activity: Apr 20, 2025, 01:17 AM