Chapter 15. Advanced SQL

The SQL shown in Chapter 5 was sufficient for the scripts in earlier chapters and for the winestore application that's described in the next five chapters. However, SQL is extremely powerful and provides many other capabilities, some of which we'll cover in this chapter. Examples of these useful features include advanced join types, nested queries, and aliases.

Many of the features shown in this chapter are specific to MySQL's version of SQL. For example, MySQL's functions are useful tools for working with strings, dates and times, and math. Also, we'll show some ways to tune MySQL in order to improve application performance. It's important to know how to choose and design indexes for fast querying, and how to use MySQL's query cache for fast results.

We cover the following topics in this chapter:

  • Exploring your database, tables, indexes, and performance with SHOW

  • More on SELECT queries, including advanced join types, aliases, nested queries, user variables, and the limitations of MySQL

  • More on manipulating data and databases, including finding out about tables and databases, creating tables with queries, altering tables, more on the UPDATE and DELETE statements, and bulk loading and exporting data

  • Functions and operators in SQL and MySQL

  • Automatically running queries

  • MyISAM, InnoDB, and Heap table types

  • Backup and recovery, and transferring data between database servers

  • Managing database server users and privileges, and creating users for web database applications

  • Basic tuning of MySQL, including index design, using the query cache, and, miscellaneous tips for speed

This chapter contains advanced concepts. If you're keen to continue working with PHP and MySQL and study our example web database application, you can jump to Chapter 16. However, if you do skip this chapter, return later when you're ready to know more about how to improve your application. If you are proceeding with this chapter, refresh your memory about our winestore database that's discussed in Chapter 5 as it's used in most examples in this chapter.



     
    ASPTreeView.com
     
    Evaluation has ОКЛ¶ґexpired.
    Info...