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

  • Home
  • SEARCH
  • 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 6049587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:35:37+00:00 2026-05-23T07:35:37+00:00

I would be really grateful if somebody could help me out with this.. I

  • 0

I would be really grateful if somebody could help me out with this..

I actually have 2 tables in my database: books and authorlist.

The book table contains a field ‘book_aut‘ which contains the foreign key of the authorlist table.

The authorlist table has only 2 fields, the primary key and the ‘authors’ column which contains a list of names.

I have to modify the table structure so that books table is linked to an authors table via a link table called ‘lnk_book_author‘

So my first task is to create a new table called ‘authors’ which contains 3 fields – primary id, name, surname, which i already did.

Next, i created the link table called ‘lnk_book_author‘ and this one contains 3 fields, the primary id, book_fk, author_fk. The book_fk and author_fk refer to the id of the book and author respectively.

My problem is that i have more than 6000 entries in the books table and i would like to know how to populate the link table with the book id and the author id.

Is there a way of doing that using sql instead of manually populating the lnk_book_author table.

Hope i was clear enough..

Thanks a lot for any suggestion provided.

  • 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-23T07:35:37+00:00Added an answer on May 23, 2026 at 7:35 am

    I’m infering the IDs already in your new [authors] table mean nothing with regards to the old tables. If that’s the case you need to relate the records by the Name. And there I need to assume that the names are entered Identically. If they’re not, it may not be possible to do. We’d need to know a lot more specifics to be sure…

    INSERT INTO
      lnk_book_author
    SELECT
      Books.PrimaryKeyFieldName,
      Authors.PrimaryKeyFieldName
    FROM
      Books
    INNER JOIN
      AuthorList
        ON Books.BookAut = AuthorList.PrimaryKeyFieldName
    INNER JOIN
      Authors
        ON CONCAT(',', AuthorList.Authors, ',') LIKE CONCAT('%,', Authors.Name, ',%')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would really appreciate it if some of you could help optimize my tables,
I would really appreciate if you could shed light on this problem. I have
I would be really grateful if someone could shed some light on this for
I'm studying Digital Image Processing by myself and would be really grateful if somebody
I would be really grateful if someone could explain how to show/ Hide UItoolbar
I would really appreciate any jquery expert help as a method I've used previously,
I would really like to do something like this: Callable<MyObject> myCallable = .... Future<MyObject>
I would really appreciate if you would take a look at this piece of
I would really like to add an image into the Sandcastle generated help file
I would really like your help in knowing the procedure to delete a .3gp

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.