An Introduction to Class::DBI - Table Relationships
|
23
|
|
Multi Table Relationships
Three related tables
CREATE TABLE person ( CREATE TABLE credit (
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
name VARCHAR(255), type VARCHAR(255),
birthdate INTEGER person_id INTEGER,
); film_id INTEGER
);
CREATE TABLE film (
id INTEGER PRIMARY KEY,
title VARCHAR(255),
year INTEGER
);
Relationships:
One to Many:
A Person has many credits, but each Credit has one Person
A Film has many credits, but each Credit has one Film
Many to Many:
|
|