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 7547831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:33:15+00:00 2026-05-30T09:33:15+00:00

I have an interesting problem here. I have a MySql database table that has

  • 0

I have an interesting problem here. I have a MySql database table that has is linked to several other tables. For example, the “main” table is a set of teaching materials, along with connected tables:

  • Grades that the material is aimed at;
  • Grammar points that the material is best used for;
  • Keywords associated with the material

I want to be able to update and change these records. Changing the main record is easy enough, but what about the connected records? For example, let’s say that I have a teaching material that I originally intend to teach verbs and adjectives, and is best used for grades 1-4. Now later on, I decide to add grade 5 to the list, remove grade 1, and that the material is actually better for teaching nouns and adjectives, but not verbs.

What would be the best way to update the grade and grammar tables? I don’t want to inadvertently overwrite data that I wanted to keep, nor to keep data that I wanted deleted. Should I just wipe out all the records associated with that particular teaching material and re-enter them, or is there some other way that I can index them so that they can be more efficiently updated?

  • 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. Editorial Team
    Editorial Team
    2026-05-30T09:33:17+00:00Added an answer on May 30, 2026 at 9:33 am

    In MySQL, you can link your tables by foreign keys. That is, you have your connected records which share these keys. Then, depending on how you instantiate your tables, you can use a CASCADE when you update a value in one table. From the manual on MySQL, when you define this foreign key you can set the CASCADE as follows:

    [CONSTRAINT [symbol]] FOREIGN KEY
    [index_name] (index_col_name, ...)
    REFERENCES tbl_name (index_col_name,...)
    [ON DELETE reference_option]
    [ON UPDATE reference_option]
    
    reference_option:
    RESTRICT | CASCADE | SET NULL | NO ACTION
    

    Where:

    CASCADE: Delete or update the row from the parent table, and automatically delete or update the matching rows in the child table. Both ON DELETE CASCADE and ON UPDATE CASCADE are supported. Between two tables, do not define several ON UPDATE CASCADE clauses that act on the same column in the parent table or in the child table.

    By default, this reference option is set to No Action.

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

Sidebar

Related Questions

I have an interesting SQL problem that I need help with. Here is the
Here's an interesting problem that I have just come across. It is possible to
Here's an interesting problem: I have some jQuery that looks like this: $(document).ready(function() {
I have an interesting problem to solve here that may require some creative direction.
Ok, I've got an interesting problem here. I have two tables, tips and votes.
I have got a weird problem here, and more interesting that it works fine
Here's an interesting problem, I have a list of users that I list in
K here is an interesting problem We have an app that is presenting with
Here's an interesting problem. I have an ETL script written in c# that I
I have an interesting problem here I've been trying to solve for the last

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.