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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:09:02+00:00 2026-06-08T14:09:02+00:00

I have a normalized table (table a) and a non-normalized table (table b), like

  • 0

I have a normalized table (table a) and a non-normalized table (table b), like this:

enter image description here

I want to insert a new row into the normalized table for each parent in the non-normalized table. So if there is a record in table B with two parents for a studentID, I want to insert two records into table A with each different parent name from table B.

I’ve been struggling for with this for hours, any help would be appreciated on how to go about doing this.

  • 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-06-08T14:09:06+00:00Added an answer on June 8, 2026 at 2:09 pm

    Assuming parentID is an auto incremental column, you could do this:

    INSERT INTO NormalizedFamily(studentID, parentName)
    SELECT studentID, parentName1
    FROM FlatFamily
    UNION
    SELECT studentID, parentName2
    FROM FlatFamily
    WHERE parentName2 IS NOT NULL
    UNION
    SELECT studentID, parentName3
    FROM FlatFamily
    WHERE parentName3 IS NOT NULL
    UNION
    SELECT studentID, parentName4
    FROM FlatFamily
    WHERE parentName4 IS NOT NULL
    

    In any case, I don’t really get why the column parentId is the key of your normalized table. As it is, the same parent can’t have multiple students related to him?, shouldn’t the key be a combination of parentID and studentID?.

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

Sidebar

Related Questions

Let's say, I have a normal normalized database like this: CREATE TABLE `users` (
I have a normalized table (table a) and a non-normalized table (table b), like
We have a non normalized table that contains foreign key infomration as free text
I have a legacy mysql database and there's this table which has a few
I have one de normalized table. I want to select all the values from
I have a table in mysql which is not normalized and I need to
edit: my table schema below is poorly normalized as suggested and I have revamped
I have a REST service that returns a collection that contains non- normalized data.
I have just normalized the font size with this: html, body, div, span, applet,
Each product will have a parent category, a category, and a subcategory. Would it

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.