Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'am trying to find out the best database design and try to stick with data integrity by using Foreign Keys. But I'm stuck right at the beginning because of limit relations between tables with FK to 1.

Currently, I'm using this schema:

enter image description here

What I really want, is to somehow connect all necessary tables with routes and use FK, if it's possible.

It mean's whenever I add a new category item, it should create a new route in routes table.
When I delete a specific category item, it should remove a route from routes database. As simple as that, but I'm sure I'am doing very wrong here.

Can someone suggest me what DB Schema I should use to stick with it ?

share|improve this question
Automatically adding a route could be done with a BEFORE trigger, but it seems wrong. As for the delete, check out CASCADE. – Alain Collins Jun 2 '14 at 16:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.