Chapter 6. Querying MySQL


So far, we have covered designing, creating, and populating a MySQL database. In this chapter and the two that follow it, we will look at the other end of this process: retrieving data from your database.

In this chapter, we will cover the SQL SELECT statement in some detail. This is probably the most important statement in SQL. It is the statement we use to select rows from one or more database table(s).

In this chapter, we will discuss how to select rows from a single database table. We'll cover the following:

  • Overview of SELECT

  • Simple queries

  • Selecting particular columns

  • Column aliases

  • Using the WHERE clause to select particular rows

  • Using the GROUP BY clause

  • Selecting particular groups with HAVING

  • Sorting search results with ORDER BY

  • Limiting search results with LIMIT

In Chapter 7, "Advanced Queries," we'll cover more advanced queries, specifically queries that span multiple tables and the different types of joins and subqueries.

In Chapter 8, "Using MySQL Built-In Functions with SELECT," we'll look at the range of functions MySQL has built in to help you with your queries.

We'll begin by looking at the general form of the SELECT statement.



MySQL Tutorial
MySQL Tutorial
ISBN: 0672325845
EAN: 2147483647
Year: 2003
Pages: 261

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net