MySQL Syntax

SQL is a sequence of English-like statements that are used to interact (get or modify data) with a database. SQL is not a programming language, it is sequence of statements that are used to elicit actions from the database server.

This makes SQL easier to read than the majority of programming languages, makes it easier to learn than programming, and also makes it easier to teach by using examples.

The following tutorial does an overview of the syntax that MySQL uses.

MySQL and Capitalization

MySQL is not case-sensitive. That means that it does not matter if you capitalize the keywords in your queries or not. However, it is a good idea to write keywords, functions, etc. in your SQL in uppercase. This aids readability and is similar to properly using whitespace when programming.

For example, this MySQL Select Query easier to read:

SELECT * FROM employees WHERE last_name = 'Pavarotti';


select * from employees where last_name = 'Pavarotti';

And you are able to understand the query faster with the keywords highlighted.

MySQL and the Semi-colon

By right, all queries should be terminated with a semi-colon, as this is the standard way of separating queries when sending them to the database server.

Some database engines force you to use a semi-colon after your SQL statements, and others are fine without the semi-colon at the end of a single query.

When using executing MySQL queries from within PHP, you should not append the semi-colon to the end of a query.

We hope this tutorial on MySQL syntax was useful.

Link to this Page

Thank Tutorial Arena for This Tutorial.
Show your appreciation with a +1...