Chapter 10. SQL

Being a part of a sentence is a Normal condition for proper performance of every elementary sentence part. But it is also more than a Normal condition. It is a necessary condition. For just what each element is supposed to do cannot be defined except in relation to the rest of the sentence .

Ruth Garrett Millikan, Language, Thought, and Other Biological Categories

SQL—often apocryphally referred to as the Structured Query Language—is the vehicle for communication with relational databases. Once you learn SQL, you are in command of the basic tool for talking to Oracle, DB2, MySQL, SQL Server, Ingres, PostgreSQL, Informix, mSQL, Sybase, Access, and any other relational database engine. Other query languages like OQL (Object Query Language) exist, but they tend to support interaction with other kinds (i.e., not relational) of databases. Even when you are accessing your database through a GUI tool or a higher-level abstraction, somewhere under the hood SQL is probably in play.

SQL is a sort of “natural” language. In other words, an SQL[21] 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 unlike traditional programming languages such as Java and C.

Background

SQL is “structured” in the sense that it follows a very specific set of rules. A computer program can parse a formulated SQL query easily. In fact, the O’Reilly book lex & yacc by John Levine, Tony Mason, ...

Get Java Database Best Practices 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.