Results 1 to 7 of 7
  1. #1
    merowing3's Avatar
    merowing3 is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2018
    Location
    Poland
    Posts
    1

    Database - books in library

    Ave.

    I have a question and I would be very grateful for some hints how to do this. I want to create a small and simple database which will consist of entries of books from library (basic information such as: title, names and surnames of authors, edition, year, publisher). I have a problem: let us assume that one book (with one title) have more then one author (for example two).



    I tried to create two tables:

    1. tblBooks (ID Book, Title, Author, Year, Publisher)
    2. tblAuthors (ID Author, Name, Surname)

    The problem is that I have only one field Author in tblBooks and if some book have two authors I can choose only one (I can create more then one field Author but when the book will have one author then all other Author fileds will be blank which is not correct). How to solve this problem? I tried to create a third table:

    3. tblBooksAuthors

    which would connect 1st and 2nd table but it didn't solved my problem. Any clues?

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    For your simple system, two tables will be sufficient

    Remove Author from tblBooks.
    Add BookID to tblAuthors and link the two tables using that.
    I advise againsthaving spaces in field names

    For more complex databases, your junction table would be used.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    Id say 3 tables,
    tBooks would not have an author (string ) field, instead it would have an AuthorGrpID field.

    the tAuthorGrp table would have the field AuthorGrpID (long) and AuthorID (long)
    so 1 book can have X authors

    tAuthors table would have AuthorID (auto) and each persons info.

    BookID, Title,AuthorGrp
    656, History of Yoyos, 321

    tAuthorGrps tbl (*keys)
    AuthorGrp*, AuthorID*
    321, 2
    321, 5

    tAuthors tbl
    AuthorID, FirstN, LastN
    2, Stephen , King
    5, Dean , Koonz
    Last edited by ranman256; 03-20-2018 at 10:56 AM.

  4. #4
    Join Date
    Apr 2017
    Posts
    1,679
    Quote Originally Posted by ranman256 View Post
    tBooks would not have an author (string ) field, instead it would have an AuthorGrpID field.
    Sorry, but in case AuthorGrpID is PK, then this allows only 1 author per book.

    tBooks: BookID, BookName, ...
    tAuthors: AuthorID, ForeName, LastName, ...
    tAuthorBook; ABID, BookID, AuthorID

  5. #5
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,974
    I think the solution depends on the amount of detail the OP wants

    If I was doing this for myself, I would definitely want 3 tables for this part of the database plus ISBN codes, additional tables for publisher etc etc
    My answer was based purely on what the OP said he wanted
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  6. #6
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    AuthorGrpID AND AuthorID would be keys, to prevent duplicates.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    When you are looking ideas regarding a database to support a business, one of the first places to look is Barry Williams' site -- where he has several free generic data models. Many have links to associated facts that led to the design of the model.

    These models are meant as a representation of the typical subjects and attributes and relationships. These can be expanded or adjusted to suit your needs. They serve as a starting point to help organize your specific model. You can use parts of the model, ignore parts, revise or extend parts or combine pieces of various models as necessary to satisfy your "business facts".

    As he says on the site "these are a kick start of database designs".

    He also has tutorials and articles related to data management and database.

    Here has a library data model at http://www.databaseanswers.org/data_...alim/index.htm

    And a more generic library conceptual model with the associated Business Facts that underlie the model.

    Good luck with your project.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Library Database
    By Spaceman in forum Access
    Replies: 1
    Last Post: 08-09-2017, 10:47 AM
  2. How to create Books Library Checkin Checkout database
    By NotesAndSoft in forum Database Design
    Replies: 1
    Last Post: 02-13-2014, 04:29 AM
  3. Replies: 1
    Last Post: 05-31-2013, 02:50 PM
  4. Library database
    By LDP in forum Programming
    Replies: 1
    Last Post: 10-03-2012, 06:11 AM
  5. Replies: 6
    Last Post: 08-04-2010, 01:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums