Results 1 to 3 of 3
  1. #1
    Ramtrap is offline Advanced Beginner
    Windows 7 64bit Access 2016
    Join Date
    Dec 2016
    Posts
    62

    Consolidation of Data

    Hi all,

    I have been racking my brain trying to reconcile this information, which my instructor was inept in explaining to me. What I'm trying to figure out is if there's an easy way for the following.

    Let's say I have two tables: Movies and Categories.

    Broken up for fields, let's say all I care about is the following:

    Movies
    1. MovieID (PRIMARY KEY)
    2. MovieTitle (ex: Star Wars)


    Categories
    1. CategoryID (PRIMARY KEY)
    2. Category (ex: Sci-Fi)


    What I want to do is have a secondary table (junction table) for a many to many relationship to identify the many different categories that a movie may belong to. In the example above, let's just say I wanted Star Wars to be linked in to Sci-Fi, Action, Space, and War.

    MovieCategories (this is the junction table)
    1. MovieID (PRIMARY KEY)
    2. CategoryID (PRIMARY KEY)

    With one movie, this junction table is easy; MovieID 1 (Star Wars) would go to CategoryID 1, 2, 3, and 4 (assuming those were the only four categories, which is obviously not true). So the table would look something like this:

    MovieID CategoryID
    1 1
    1 2


    1 3
    1 4

    Okay, so far, so good? Now, multiply the number of MovieIDs by 10,000. How can I most easily give appropriate categories to movie titles without having to do so by arbitrary ID numbers? How do I best build that table and still keep everything normalized? Does this make any sense?

    I've attached a basic outline of what I'm dealing with, along with a pre-completed Junction Table (ID'd as: tblAMoviesCategories). If that table were delete, is there an easy way to reattribute those categories to the movie titles without having to do so at the primary key level? I have a project that has nothing to do with movies, but I'm trying to see if there's a better way to come up with a solution because I'm building a database from scratch and it almost seems easier to build either one large table with all this stuff in there (i.e. not normalized at all) or a slew of excel spreadsheets I can import and delete columns as necessary).

    Any help would be much appreciated. Thank you!
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    DONT use CataID.
    The catagory table has unique names, use them as the key. (not numbers)

    tCata
    ------
    scifi
    action
    romance

    Unlike People ,who cannot be index on a unique identifier, some things can. (state codes, country codes, movie cataories)
    so just use plain text as your key!

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    ramtrap,

    Here is an article describing the design of a junction table to accommodate a many to many relationship.

    Here is a link to wikipedia article on associative entity-- also referred to as
    linking table, bridge table, bridging table, junction table, mapping table and many more....

    Here is another source with an example of junction table and Many to Many relationship.

    Good luck.

    Also: I can not open your zip ---get an error.

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

Similar Threads

  1. Replies: 1
    Last Post: 12-21-2011, 02:11 PM
  2. Consolidation codes from different table.
    By suverman in forum Queries
    Replies: 3
    Last Post: 05-13-2011, 10:39 AM
  3. Need help with code logic/consolidation
    By bg18461 in forum Programming
    Replies: 1
    Last Post: 03-31-2010, 04:19 PM
  4. Consolidation DB
    By dimitrz in forum Database Design
    Replies: 7
    Last Post: 03-23-2010, 12:44 PM

Tags for this Thread

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