# ExampleDB version 1

- Address
- EmailAddress
- Person
- PhoneNumber

## Address (table addresses)

### Columns

Name | Type | Info
--- | --- | ---
id | integer | NOT NULL, PRIMARY KEY, AUTO_INCREMENT
person_id | integer | NOT NULL, FOREIGN KEY
name | varchar(64) | NOT NULL
| Home, work, etc
address1 | varchar(128) | NOT NULL
address2 | varchar(128) |
city | varchar(64) | NOT NULL
state | varchar(2) | NOT NULL
zip_code | varchar(10) | NOT NULL

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
person | Person | foreign.id => self.person_id

## EmailAddress (table email_addresses)

### Columns

Name | Type | Info
--- | --- | ---
id | integer | NOT NULL, PRIMARY KEY, AUTO_INCREMENT
person_id | integer | NOT NULL, FOREIGN KEY
name | varchar(64) | NOT NULL
| Home, work, etc
email | varchar(128) | NOT NULL

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
person | Person | foreign.id => self.person_id

## Person (table people)

### Columns

Name | Type | Info
--- | --- | ---
id | integer | NOT NULL, PRIMARY KEY, AUTO_INCREMENT
name | varchar(64) | NOT NULL
username | varchar(16) |
birthdate | date | NOT NULL, INFLATED

### Relationships

has_many
Name | Foreign Class | Join Condition
--- | --- | ---
addresses | Address | foreign.person_id => self.id
emails | EmailAddress | foreign.person_id => self.id
phone_numbers | PhoneNumber | foreign.person_id => self.id

## PhoneNumber (table phone_numbers)

### Columns

Name | Type | Info
--- | --- | ---
id | integer | NOT NULL, PRIMARY KEY, AUTO_INCREMENT
person_id | integer | NOT NULL, FOREIGN KEY
name | varchar(64) | NOT NULL
| Home, work, etc
phone_number | varchar(32) | NOT NULL

### Relationships

belongs_to
Name | Foreign Class | Join Condition
--- | --- | ---
person | Person | foreign.id => self.person_id