Login | Contact Us | Site Map | Resources

Introduction to MYSQL

Home > MYSQL Tutorial > MYSQL Syntax

MYSQL Syntax

Syntax is a set of rules that define how MYSQL can and cannot be written. MYSQL is, in that sense, no different from any other language. If I wrote this sentence backward and upside down, it would not be following the rules, and it is doubtful that anyone would understand it.

MYSQL expects only one main rule to be followed. Each statement must end with a semicolon ";" in order to indicate that the statement has ended.

MYSQL "code" is easy to read and write, and will make sense as long as you understand the English language.

A useful habit when writing MYSQL is capitalizing the reserve works that make up each command that is written. This helps to separate the reserve words and make the intent of the code more obvious at a glance.

The two lines below perform the same function of displaying all of the data stored in the "example" table, but only one allows you to separate reserve words at a glance.

SELECT * FROM example;

select * from example;

If you think that the second example is easier to read and interpret, then we will agree to disagree, and I will continue to use the syntax of the first example of the sake of this tutorial and my future MYSQL projects. ;-)