diff --git a/doku/content.tex b/doku/content.tex index 5b26299..55923d0 100644 --- a/doku/content.tex +++ b/doku/content.tex @@ -204,7 +204,8 @@ Enthält die möglichen Anreden für Personen. \textbf{cities / (Städte)} \newline -Enthält Städtenamen sowie die dazugehörige Postleizahl. +Enthält Städtenamen sowie die dazugehörige Postleizahl und einem +Verweis zu welchem Land die jeweilige Stadt gehört. \textbf{countries / (Länder)} \newline diff --git a/sql/sql/setup_02_create_table.sql b/sql/sql/setup_02_create_table.sql index b5c57d4..23404aa 100644 --- a/sql/sql/setup_02_create_table.sql +++ b/sql/sql/setup_02_create_table.sql @@ -111,6 +111,7 @@ if not exists (select * from sysobjects where name='cities') city_id int identity not null, city_name varchar(50) not null, zip_code int not null, + country_id int not null, constraint city_pk primary key (city_id) ); @@ -157,6 +158,11 @@ if not exists (select * from sysobjects where name='rent_prices') -- Add constraints +use marketdb; +IF OBJECT_ID('dbo.[fk_cit_country_id]', 'F') IS NULL + ALTER TABLE cities ADD CONSTRAINT fk_cit_country_id + FOREIGN KEY (country_id) REFERENCES countries (country_id); + use marketdb; IF OBJECT_ID('dbo.[fk_com_member_id]', 'F') IS NULL ALTER TABLE commercials ADD CONSTRAINT fk_com_member_id