MySQL and PostgreSQL

MySQL and PostgreSQL are both open source databases ideal for small and medium size web sites. Both have similarities that make them equally good choices for most Web sites, and both have special features that will make one the best choice for some projects. The first part of this chapter cover the similarities and differences that will help you choose one of the databases, and the second part, the Immediate Solutions section, shows you how to perform the most common and important tasks with both MySQL and PostgreSQL. In addition, I will build toward code that is similar for both databases, so you will have the minimum conversion work if you have to change from one to the other.

The chapter on MySQL and PostgreSQL contains the following sections:
   In Depth
      History
         MySQL
         PostgreSQL
      Some Differences
         Dates
         Case Sensitivity
         Transactions
         Stored Procedures
         Triggers
         Views
      Data Types
         Bits
         Integers
         Floating-Point Numbers
         Strings
         Blobs
         Dates and Time
         PostgreSQL Specials
         Inserting
      Platform Independence
      Turning Raw Data into Databases
      Arrays and Databases
      To Index or Not to Index
      Relationships
      ODBC
   Immediate Solutions
      Connecting to a Database
      Listing Databases
      Displaying Database Tables
      Displaying Table Fields
      Displaying Table Data
      Inserting a Row of Data
      Creating a Database
      Creating Tables
      Using Databases for Sessions
      Cleaning Up Code