Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 82311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:35:49+00:00 2026-05-10T21:35:49+00:00

I have two tables. Club and Coach. Between them is 0,1 – 0,1 relationship

  • 0

I have two tables. Club and Coach. Between them is 0,1 – 0,1 relationship (coach can have zero or one club. club can have zero or one coach). When I want to change the coach of the given club, i have to update the club table. So i have to change idCoach of that club. Lets consider a new coach (the newly assigned coach of the given club) is already a coach of some other club. I have to set to Null field idCoach of that club, because his coach will be assigned to another club. Also if the club for which I want to change the coach, already has a coach, then I have to set idClub of that coach (in Coach table) to Null.

All the given above, also applies to when I want to change the club of the certain coach. (have to set to Null idCoach field of the previous club of a given coach and have to set to null idCoach of the new club) .

The same problems could occur when I insert new record in Club or Coach table, or if I delete the existing (in insert, update and delete I have to watch out for the corresponding references and unlink them).

I want to solve this with triggers. I guess I would have to have 3 triggers in Club table (for insert, update and delete) and 3 more in Coach table.

In update trigger (for example in Club) I have to update Coach table which will again trigger update in Club (cause in it’s body it has to update Club table) and that trigger will update Coach and trigger and so forth. So I’ll have a dead lock.

How to solve this?

This is the first time ever I work with triggers, so sorry in advance, for this big explanation of a simple thing.

Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:35:50+00:00Added an answer on May 10, 2026 at 9:35 pm

    I suggest this might not be an appropriate use for triggers, which are very difficult to debug, and often surprise people by the way they don’t support single-record operations as you would expect. Break it down into simple SQL statements and wrap a transaction around it instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables connected with one to many relationship. Parent Table is a
Have two tables with a linking table between them. USERS +-------+---------+ | userID| Username|
I have two tables one with ID and NAME table 1 ID | NAME
I have two tables in my MySQL database, one is a library of all
Have two tables say ABC and XYZ and contain one column which data will
I have two tables: one table (okay, it's a view), vComputer, lists many computers
I have two tables: jobs & activities. A job consists of zero or more
I have two tables in my database. A person and a coach table. The
We have two Tables: Document: id, title, document_type_id, showon_id DocumentType: id, name Relationship: DocumentType
I have two tables containing Tasks and Notes, and want to retrieve a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.