Chapter 6. SQL According to MySQL and mSQL

The Structured Query Language (SQL) is the language used to read and write to MySQL and mSQL databases. Using SQL, you can search for data, enter new data, modify data, or delete data. SQL is simply the most fundamental tool you will need for your interactions with MySQL and mSQL. Even if you are using some application or graphical user interface to access the database, somewhere under the covers that application is generating SQL.

SQL is a sort of “natural” language. In other words, an SQL statement should read—at least on the surface—like a sentence of English text. This approach has both benefits and drawbacks, but the end result is a language very unlike traditional programming languages such as C, Java, or Perl.

In this chapter, we take a look at the SQL language as supported in MySQL and mSQL. For the most part, MySQL’s dialect is a superset of mSQL’s. We will carefully note the instances where the two dialects diverge. For the most part, however, this chapter applies to both database engines.

SQL Basics

SQL[7] is “structured” in the sense that it follows a very specific set of rules. A computer program can easily parse a formulated SQL query. In fact, the O’Reilly book lex & yacc by John Levine, Tony Mason, and Doug Brown implements a SQL grammar to demonstrate the process of writing a program to interpret language! A query is a fully-specified command sent to the database server, which then performs the requested action. Below is ...

Get MySQL and mSQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.