NAME

DBSchema::Sample - Sample schema including all common relations

SYNOPSIS

#=====================================================================
# DECLARATIONS
#=====================================================================
use strict;
use DBSchema::Sample;

my $dbh = dbh();
my $sql = DBSchema::Sample->sql;

#=====================================================================
#  PROGRAM PROPER
#=====================================================================


for (@$sql) {
    warn $_;
    $dbh->do($_); 
}


#=====================================================================
#  SUBROUTINES
#=====================================================================

#
# modify for your method of getting $dbh (DBI database handles)
#

sub dbh {
    use DBIx::Connect;

    my $dbh = DBIx::Connect->to('horse1_test');

}

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.

Tested on MySQL 4.0.14. Subclasses for other databases welcome.

EXPORT

None by default.

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

AUTHOR

T. M. Brannon, tbone@cpan.org

SEE ALSO

perl.