locked
Insert into Many-To-Many Tables ? RRS feed

  • Question

  • I have below tables:

    Books               Auther               Book_Auther
    -------                --------               ----------------
    BookID             AutherID            Book_AutherID
    Book_Name     Auther_Name     BookID
    Book_Pic                                    AutherID

    I have one form to enter books details Book_Name (Text box), Book_Pic (Upload), Auther_Name (drop down list)..

    How the Insert command should be in the Save botton?
    How the Update command should be ?
    How to Upload book pic?

    Your help is highly appreciated.


    Nothing is impossible
    Saturday, November 5, 2011 3:54 AM

Answers

  • Your question is more about application design. Your tables appear to be properly designed to accomodate the M-M relationship between books and authors.

    According to your information, author names are stored in a drop-down list. How does the user enter a *new* author not already in the list? Did you mean combo box?

    You have a textbox for book title entry. How do you prevent users from entering a duplicate title with a typo? Further, book titles are not unique in the universe of books. Should you consider use of ISBN as the primary key to prevent duplication?

    That said, according to your information, the author row will already be present, so your should first INSERT the new book row, then insert the needed intersection row.

     

    • Proposed as answer by Naomi NEditor Sunday, November 6, 2011 12:49 AM
    • Marked as answer by Stephanie Lv Monday, November 14, 2011 12:50 AM
    Saturday, November 5, 2011 4:55 PM
  • Thoughts and notes:

    1. Books can have more than one version. If they to be logically grouped, the picture would go in another TABLE.
    2. A library can have more than one copy of the same book. If they to be logically grouped, it requires another TABLE.
    3. "Auther" in English, is spelled "Author".

    • Proposed as answer by Naomi NEditor Monday, November 7, 2011 3:01 PM
    • Marked as answer by Stephanie Lv Monday, November 14, 2011 12:50 AM
    Monday, November 7, 2011 1:34 PM
    Answerer
  • Thank youvery much for your help..!!
    Nothing is impossible
    • Marked as answer by BinShehab Friday, March 2, 2012 4:07 AM
    Sunday, November 13, 2011 11:37 AM

All replies

  • Your question is more about application design. Your tables appear to be properly designed to accomodate the M-M relationship between books and authors.

    According to your information, author names are stored in a drop-down list. How does the user enter a *new* author not already in the list? Did you mean combo box?

    You have a textbox for book title entry. How do you prevent users from entering a duplicate title with a typo? Further, book titles are not unique in the universe of books. Should you consider use of ISBN as the primary key to prevent duplication?

    That said, according to your information, the author row will already be present, so your should first INSERT the new book row, then insert the needed intersection row.

     

    • Proposed as answer by Naomi NEditor Sunday, November 6, 2011 12:49 AM
    • Marked as answer by Stephanie Lv Monday, November 14, 2011 12:50 AM
    Saturday, November 5, 2011 4:55 PM
  • Thoughts and notes:

    1. Books can have more than one version. If they to be logically grouped, the picture would go in another TABLE.
    2. A library can have more than one copy of the same book. If they to be logically grouped, it requires another TABLE.
    3. "Auther" in English, is spelled "Author".

    • Proposed as answer by Naomi NEditor Monday, November 7, 2011 3:01 PM
    • Marked as answer by Stephanie Lv Monday, November 14, 2011 12:50 AM
    Monday, November 7, 2011 1:34 PM
    Answerer
  • Thank youvery much for your help..!!
    Nothing is impossible
    • Marked as answer by BinShehab Friday, March 2, 2012 4:07 AM
    Sunday, November 13, 2011 11:37 AM