Terrence Brannon > DBSchema-Sample > DBSchema::Sample

Download:
DBSchema-Sample-2.0.a.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 2.0.a   Source  

NAME ^

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

SYNOPSIS ^

This program builds and populates a small but realistic database.

USAGE / INSTALLATION ^

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 ^

You can get a PDF of the schema to view here:

http://github.com/metaperl/dbschema-sample/blob/e94b148318147f835f27a6a17587f7d87c956fbb/etc/dbschema.pdf

authors =1:n=> titleauthors

au_id is a surrogate primary key for the authors table (au_id, title_id) is the primary key for the titleauthors table

titles =1:n=> titleauthors

title_id is a surrogate primary key for the titles table.

Therefore authors =n:n=> titles

titles =1:n=> titleditors

editors =1:n=> titleditors

ed_id is a surrogate primary key for the authors table

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.

roysched has title_id as a foreign key. And title_id is the primary key in titles.

publishers =1:n=> titles

pub_id is the surrogate primary key.

titles =1:n=> salesdetails

sales =1:n=> salesdetails

sales has sonum as a primary key. sonum is a foreign key in salesdetails.

Therefore titles =n:n=> sales

AUTHOR ^

T. M. Brannon, tbone@cpan.org

SOURCE

http://github.com/metaperl/dbschema-sample/tree/master

SEE ALSO ^

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

Other sample databases

GMAX's

https://launchpad.net/test-db/ and http://datacharmer.blogspot.com/2008/07/dont-guess-test-sample-database-with.html

syntax highlighting: