CHAPTER 5Basic SQLSQL is the only database language in widespread use. Since it was first proposed in the
early sit has been criticized, changed, extended, and finally adopted by all the players in the database market. The latest standard is SQL-2003—the 2003 denotes its release year—but the version supported by most database servers is more closely
related to its predecessors, SQL and SQL. MySQL supports most of the features of
SQL-1992 and many
from the newer SQL standards, but it also includes many nonstandard features that give more control over the database server and how it evaluates queries and returns results.
This chapter introduces the basics of MySQL’s implementation of SQL. We show you how to read data from a database with the
SELECT
statement, and how to choose what data is returned and the order it is displayed in. We also show you the basics of modifying
your databases with the INSERT
statement to add data,
UPDATE
to change, and
DELETE
to remove it. We also explain how to use
the nonstandard SHOW TABLESand
SHOW
COLUMNS
statements to explore your database.
Following our example-based approach, we use the music database designed in Chapter to show you how to
work with an existing database, and use basic SQL to read and write data. In Chapter 6, we’ll explain how to create the music database on your
MySQL server. We’ll also show how you can create
your own database and tables, and modify the structure of existing ones. In Chapters 7 and 8, you’ll learn about some advanced features of the SQL variant used by MySQL.
Share with your friends: