03 - SQL Syntax

Syntax means following set of rules and patterns, even for SQL one has to follow the syntax. SQL is case in-sensitive, that is keyword SELECT and select is same for SQL. Every SQL command should end with a semi-colon (;).

If the syntax is not proper, then executing the command would result in syntax error. 

 

SQL SELECT Command example:

            SELECT col1, col2, col3,….. 

            FROM table_name;

 

Example:

Consider you have to select columns from a table, (this is most used command in SQL).

 

 SELECT * FROM EMPLOYEE

The above command would result in the SQL implementation (here MYSQL) to wait for the ending command that is semicolon (;). Once you give the semicolon the command would be executed. 

 

 

mysql> select * from employee

    ->

    -> ;

Empty set (0.00 sec)

In the above screenshot, you can see how MySQL executed the command only after ‘;’ was provided.

Like us on Facebook