As we mentioned earlier, SQL resembles a human language more than a computer language because it has a simple, defined imperative structure. Much like an English sentence, individual SQL commands, called “queries,” can be broken down into language parts. Consider the following examples:
CREATE TABLE people (name CHAR(10)) verb object adjective phrase INSERT INTO people VALUES ('me') verb indirect object direct object SELECT name FROM people WHERE name LIKE '%e' verb direct object indirect object adjective phrase
Most implementations of
SQL, including MySQL, are case
insensitive. Specifically, it does not matter how you type SQL
keywords as long as the spelling is correct. The previous
CREATE example could just as well be:
cREatE TAblE people (name cHaR(10))
The case insensitivity extends only to SQL keywords. In MySQL, names of databases, tables, and columns are case-sensitive. This case sensitivity is not necessarily true for all database engines. Thus, if you are writing an application that should work against all databases, you should assume that names are case sensitive.
This first element of an SQL query is always a verb. The verb
expresses the action you wish the database engine to take. While the
rest of the statement varies from verb to verb, they all follow the
same general format: you name the object upon which you are acting
and then describe the data you are using for the action. For example,
CREATE TABLE people (name CHAR(10)) uses the ...