The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

DBSchema::Sample - build and populate a realistic sample schema.

SYNOPSIS

This program builds and populates a small but realistic database.

USAGE / INSTALLATION

  • Install whatever database you want

    Postgres 7.4, MySQL 4.0.14 and SQLite 2.8.6 have been tested

  • Create a database

     CREATE DATABASE test

    For SQLite, this step is not necessary.

  • Install DBI

  • Install appropriate DBD

    DBD::SQLite and DBD::mysql have been tested

  • Install DBSchema::Sample

    When it follows the prereqs, it installs DBIx::AnyDBD.

  • Load the Database

     perl -MDBSchema::Sample -e load

    Follow the prompts for DBI connection information and the tables will be built and populated.

    SQLite users: when this command is run, be sure to run it in a directory where there is no directory named the same as your database and if there is a file with the name of your database, that file is in fact your database.

DESCRIPTION

This creates the database schema discussed in "The Practical SQL Handbook by Bowman, Emerson and Darnovsky" (Addison-Wesley). It is useful to have something like this when you want to play around with a DBI wrapper (or 12) but don't feel like creating a realistic schema and populating it with sensible data.

EXPORT

 load()

SCHEMA DESCRIPTON

authors =1:n=> titleauthors

titles =1:n=> titleauthors

Therefore authors =n:n=> titles

titles =1:n=> titleditors

editors =1:n=> titleditors

Therefore editors =n:n=> titles

titles =1:n=> roysched

At first, I didn't understand how a title could have more than one royalty, then I realized that a title has varying royalties based on the total volume sold.

publishers =1:n=> titles

titles =1:n=> salesdetails

sales =1:n=> salesdetails

Therefore titles =n:n=> sales

AUTHOR

T. M. Brannon, tbone@cpan.org

SEE ALSO

DBIx::AnyDBD DBD::mysql DBD::SQLite DBIx::Recordset::Playground Class::DBI DBI