Professional Web Applications Themes

Junction Table Question - Microsoft SQL / MS SQL Server

Are there any advantages/disadvantages of adding an identity column in a junction table that resolves a many- to-many relationship? Thanks Alex...

  1. #1

    Default Junction Table Question

    Are there any advantages/disadvantages of adding an
    identity column in a junction table that resolves a many-
    to-many relationship?

    Thanks
    Alex
    AlexD Guest

  2. #2

    Default Junction Table Question

    What would you use it for.
    The problem comes if that value is then used as a foreign
    key on another table. You always have to go back to the
    conjoint table to get the joined fields as the foreign key
    doesn't have that info.
    You will still need a unique index on the other fields so
    it is just adding complexity.

    It's an area that people will probably argue though.

     
    Nigel Guest

  3. #3

    Default Re: Junction Table Question

    A table is an unordered set of rows. The only way to guarantee ordering
    is with a SQL ORDER BY clause. This is because most efficient manner to
    return data is not necessarily the sequence you might expect.

    For performance reasons, one often employs a clustered index so that
    related data is physically grouped together. In your example, it may be
    appropriate to create a clustered index on userID and ID2 if data are
    often retrieved (and perhaps ordered by) userID and ID2.

    --
    Hope this helps.

    Dan Guzman
    SQL Server MVP

    -----------------------
    SQL FAQ links (courtesy Neil Pike):

    http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
    http://www.sqlserverfaq.com
    http://www.mssqlserver.com/faq
    -----------------------

    "AlexD" <com> wrote in message
    news:0edc01c367f8$36ae9fb0$gbl... 
    > key 
    > >.
    > >[/ref][/ref]


    Dan Guest

Similar Threads

  1. Commission Junction html links
    By livefearless in forum Macromedia Contribute General Discussion
    Replies: 0
    Last Post: August 9th, 08:25 PM
  2. Data Junction?
    By Bob Castleman in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 11th, 08:08 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139