All pastes #588027 Raw Edit

Someone

public text v1 · immutable
#588027 ·published 2007-06-25 09:36 UTC
rendered paste body
hi all.
Imagine a situation. There is a big company which has many service centers. These service centers provide different service types - some of them replace car tires, others repair engines, and other ones fill petrol or another fuel.

    No we have the following:

Table of service centers
------------------------
ID
name
address

Table of service types
----------------------
ID
name

Table of work types
-------------------
ID
service_type_ID
name

Now i bind service centers and service types

bind_table
--------------------------------------------
service_center_ID
service_type_ID

And now i want to log which works were done on each service center

Table "works"
-------------
ID (to refer it later in material consumption table etc...)
date_time (date when the work was done)
service_center_ID
work_type_ID

Seems like it's ok, but it is possible to write incorrect record for example work "tire replacement" on service point which only repairs engines (as specified in bind_table). Is it possible to avoid such errors at database level?