Schéma : pagila (films)

pagila, address, customer, store, relationnel, pattes de corbeau, crowfoot

pagila
crowfoot
DDL
Published

September 20, 2024

Présentation de la partie address du schéma pagila, pour l’entrainement à PostGres.

Schema pagila créé par DbSchema

Contexte

Table pagila.address

Idx Name Data Type
* 🔑 ⬋ address_id integer DEFAULT nextval(‘pagila.address_address_id_seq’::regclass)
* address varchar(50)
address2 varchar(50)
* district varchar(20)
* 🔎 ⬈ city_id smallint
postal_code varchar(10)
* phone varchar(20)
* last_update timestamp DEFAULT now()

Foreign Keys

Type Name On
address_city_id_fkey ( city_id ) ref pagila.city (city_id)

Table pagila.city

Idx Name Data Type
* 🔑 ⬋ city_id integer DEFAULT nextval(‘pagila.city_city_id_seq’::regclass)
* city varchar(50)
* 🔎 ⬈ country_id smallint
* last_update timestamp DEFAULT now()

Foreign Keys

Type Name On
city_country_id_fkey ( country_id ) ref pagila.country (country_id)

Table pagila.country

Idx Name Data Type
* 🔑 ⬋ country_id integer DEFAULT nextval(‘pagila.country_country_id_seq’::regclass)
* country varchar(50)
* last_update timestamp DEFAULT now()

Table pagila.customer

Idx Name Data Type
* 🔑 ⬋ customer_id integer DEFAULT nextval(‘pagila.customer_customer_id_seq’::regclass)
* 🔎 ⬈ store_id smallint
* first_name varchar(45)
* 🔎 last_name varchar(45)
email varchar(50)
* 🔎 ⬈ address_id smallint
* activebool boolean DEFAULT true
* create_date date DEFAULT (‘now’::text)::date
last_update timestamp DEFAULT now()
active integer

Foreign Keys

Type Name On
customer_store_id_fkey ( store_id ) ref pagila.store (store_id)
customer_address_id_fkey ( address_id ) ref pagila.address (address_id)

Table pagila.staff

Idx Name Data Type
* 🔑 ⬋ staff_id integer DEFAULT nextval(‘pagila.staff_staff_id_seq’::regclass)
* first_name varchar(45)
* last_name varchar(45)
* ⬈ address_id smallint
email varchar(50)
* ⬈ store_id smallint
* active boolean DEFAULT true
* username varchar(16)
password varchar(40)
* last_update timestamp DEFAULT now()
picture bytea

Foreign Keys

Type Name On
staff_store_id_fkey ( store_id ) ref pagila.store (store_id)
staff_address_id_fkey ( address_id ) ref pagila.address (address_id)

Table pagila.store

Idx Name Data Type
* 🔑 ⬋ store_id integer DEFAULT nextval(‘pagila.store_store_id_seq’::regclass)
* 🔍 ⬈ manager_staff_id smallint
* ⬈ address_id smallint
* last_update timestamp DEFAULT now()

Foreign Keys

Type Name On
store_manager_staff_id_fkey ( manager_staff_id ) ref pagila.staff (staff_id)
store_address_id_fkey ( address_id ) ref pagila.address (address_id)