Installing the Sample Database

   

If you want, you can download a sample database from this book's web site: http://www.conjectrix.com/pgbook.

After you have downloaded the bookdata.tar.gz file, you can unpack it with either of the following commands:

 $ tar zxvf bookdata.tar.gz 

or

 $ gunzip c bookdata.tar.gz  tar xvf 

The bookdata.tar.gz file contains a number of files and will unpack into your current directory. After unpacking, you will see a subdirectory for each chapter (okay, for most chapters ”not all chapters include sample code or sample data).

You can use the chapter1/load_sample.sql file to create and populate the three tables that I have discussed ( tapes , customers , and rentals ). To use the load_sample.sql file, execute the following command:

 $ psql d movies f chapter1/load_sample.sql 

This command drops the tapes , customers , and rentals tables (if they exist), creates them, and adds a few sample rows to each one.

   


PostgreSQL
PostgreSQL (2nd Edition)
ISBN: 0672327562
EAN: 2147483647
Year: 2005
Pages: 220
Authors: Korry Douglas

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