[Solved] Database model for car-service [closed]


Maybe a table like this one can help you model the price changes:

create table service (
  id int primary key not null,
  name varchar(50)
);

create table car_type (
  id int primary key not null,
  name varchar(50)
);

create table location (
  id int primary key not null,
  name varchar(50)
);

create table service_price (
  service_id int not null,
  car_type_id int not null,
  location_id int not null,
  price numeric(12,2) not null,
  constraint fk1 foreign key service_id references service (id),
  constraint fk2 foreign key car_type_id references car_type (id),
  constraint fk3 foreign key location_id references location (id)
);  

This way the price is stored separately per service, per car type, and per location.

solved Database model for car-service [closed]