Entity address
A postal address of a customer.
Subject areas: Sales
Attributes
| # | Name | Type | Null | Default | Key | Terms | Description |
| 1 | id | bigint | no | | PK | | |
| 2 | customer_id | bigint | no | | FK | | |
| 3 | line1 | text(200) | no | | | | |
| 4 | line2 | text(200) | yes | | | | |
| 5 | city | text(100) | no | | | | |
| 6 | postal_code | text(20) | no | | | | |
| 7 | country | char(2) | no | | | | |
Keys
| Kind | Name | Attributes |
| primary | pk_address | id |
Relationships
| Name | Role | Other entity | Cardinality | Attributes | Identifying | On delete | On update |
| address_customer | child | customer | one to many | address.customer_id -> customer.id | no | cascade | no_action |
Physical
lite (sqlite): main.address
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
| 1 | id | integer | no | | by_default | | id | |
| 2 | customer_id | integer | no | | | | customer_id | |
| 3 | line1 | text | no | | | | line1 | |
| 4 | line2 | text | yes | | | | line2 | |
| 5 | city | text | no | | | | city | |
| 6 | postal_code | text | no | | | | postal_code | |
| 7 | country | text | no | | | | country | |
- primary key pk_address (id)
- foreign key fk_address_customer (customer_id) references customer (id) on delete cascade
- index ix_address_customer (customer_id)
pg (postgresql): public.address
| # | Name | Type | Null | Default | Identity | Collation | Attribute | Comment |
| 1 | id | bigint | no | | always | | id | |
| 2 | customer_id | bigint | no | | | | customer_id | |
| 3 | line1 | varchar(200) | no | | | | line1 | |
| 4 | line2 | varchar(200) | yes | | | | line2 | |
| 5 | city | varchar(100) | no | | | | city | |
| 6 | postal_code | varchar(20) | no | | | | postal_code | |
| 7 | country | char(2) | no | | | | country | |
- primary key pk_address (id)
- foreign key fk_address_customer (customer_id) references customer (id) on delete cascade
- index ix_address_customer (customer_id)