+ 7

Semicolon mandatory or not?

It is not clear to me the comment: Remember to end each SQL statement with a semicolon to indicate that the statement is complete and ready to be interpreted. In this tutorial, we will use semicolon at the end of each SQL statement. If semicolon must be used, why state that they will be used in the tutorial? What happen if we don't use semicolon? Thanks in advance for your help.

29th Apr 2017, 11:40 AM
Daniele Gaito
Daniele Gaito - avatar
7 odpowiedzi
+ 4
when using more than one statement, you have to end each statement with a semicolon.
29th Apr 2017, 11:45 AM
Mario L.
Mario L. - avatar
+ 2
Hi Daniele, technically you could dispense with the terminator ; bit I suggest to use it, because if adhere to a standard without a loss of functionality, then our code is not tied to a propietary vendor. I hope I answered to your question. Cheers Francesco.
2nd May 2017, 7:48 AM
Francesco Attanasio
Francesco Attanasio - avatar
+ 1
Its not mandatory its optional in SQL.
29th Apr 2017, 11:43 AM
Vishal Prajapati
+ 1
basically the semicolon is used to terminal the command, separated them with others. if your command is the last one in block of code it does not need to have semicolon, most of programing languages have that behavior
1st Sep 2017, 2:06 AM
Than Phan
Than Phan - avatar
+ 1
it's optional in sql
1st Sep 2017, 7:12 AM
ganesh y
ganesh y - avatar
+ 1
It depends on which "dialect" SQL you are using. T_SQL requires a semicolon when have more than 1 query in a commander. However, I do not think it is optional at all when I was using WinSQL software. It doesn't accept a semicolon at all.
20th Sep 2017, 12:01 PM
matthew
+ 1
all queries should be ended with ;
20th Sep 2017, 2:24 PM
MANOJ HEGDE
MANOJ  HEGDE - avatar