Professional Web Applications Themes

foreign keys - Microsoft Access

On Sun, 05 Jan 2003 16:40:56 -0500, "Matty" <mattycruftdaemons.net> wrote: >Howdy folks, > >I am hoping someone can clarify something for me. If I >create a foreign key constraint on a table: > >ALTER TABLE bingo ADD constraint for_key_bingo >FOREIGN KEY (col1, col2) >REFERENCES yikes (col1,col2); > >and then add a new row to bingo, the col1/col2 attribute >values have to exist in yikes. I am curious what other >uses folks have for foreign keys? > >Thanks for any insight, >Ryan > > > > > This can't be a serious question. What else did you expect? The * purpose ...

  1. #1

    Default Re: Foreign Keys

    On Sun, 05 Jan 2003 16:40:56 -0500, "Matty" <mattycruftdaemons.net>
    wrote:
    >Howdy folks,
    >
    >I am hoping someone can clarify something for me. If I
    >create a foreign key constraint on a table:
    >
    >ALTER TABLE bingo ADD constraint for_key_bingo
    >FOREIGN KEY (col1, col2)
    >REFERENCES yikes (col1,col2);
    >
    >and then add a new row to bingo, the col1/col2 attribute
    >values have to exist in yikes. I am curious what other
    >uses folks have for foreign keys?
    >
    >Thanks for any insight,
    >Ryan
    >
    >
    >
    >
    >
    This can't be a serious question.
    What else did you expect? The * purpose * of the foreign key is to
    avoid orphaned records and to enforce relational integrity.
    You need a foreign key if you have a *relationship* between 2
    entities. If you don't define foreign keys and don't enforce
    relational integrity, you will end up in a mess. Obviously, given your
    question, you don't care about that.


    Sybrand Bakker, Senior Oracle DBA

    To reply remove -verwijderdit from my e-mail address
    Sybrand Bakker Guest

  2. #2

    Default foreign keys

    So the question is - Why doesn't the foreign key get
    automatically insertted? :(
    -Josh
    >-----Original Message-----
    >On Wed, 23 Jul 2003 06:58:08 -0700, "Josh"
    <jsharpecox.net> wrote:
    >
    >>I never said it's a one-to-one relationship
    >>It's one-to-many.
    >
    >Pardon my misinterpretation!
    >
    >>Two Tables:
    >>
    >>People: Address:
    >>
    >>PeopleID --AddressID
    >>Name / City
    >>AddressID--- State
    >
    >Is PeopleID an Autonumber? And People.AddressID a Long
    Integer and
    >Address.AddressID an Autonumber?
    ***Yes and Yes, they're both defaults***
    >
    >>So I create an Address form that only has a City and a
    >>State field. Then I create a People subform(datasheet
    >>view) and stick it into the Address form.
    >
    >ok...
    >
    >>Then in the People properties of the main form I said
    the
    >>Link Child/Master fields to AddressID.
    >
    >sounds good...
    >
    >>As far as I know that's all I needed to set up.
    >>Apparently I'm missing something.
    >
    >That all looks correct to me! I'll have to go digging
    through old
    >messages to find your previous message (hint: it's a LOT
    easier if you
    >reply to a message in a thread rather than starting a
    new thread) to
    >find out exactly what's happening, but I don't see
    anything you've
    >done wrong!
    >
    >
    > John W. Vinson[MVP]
    > Come for live chats every Tuesday and Thursday
    >[url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    >.
    >

    Josh Sharpe Guest

  3. #3

    Default Re: foreign keys

    On Fri, 25 Jul 2003 09:33:15 -0600, John Vinson
    <jvinsonSTOP_SPAM.WysardOfInfo.com> wrote:
    >On Thu, 24 Jul 2003 20:43:56 -0400, "Josh Sharpe" <jsharpecox.net>
    >wrote:
    >
    >>So the question is - Why doesn't the foreign key get
    >>automatically insertted? :(
    >
    >Good question, one to which I do not know the answer.
    >
    >I rarely do this but this one has me really puzzled. Please compact
    >and zip the database, if it's not confidential, and EMail it to me -
    >my reply-to address is antispammed in a reasonably obvious manner.
    >This has to be something simple!
    For those interested... on my machine (running Access2002 on an
    Access2000 format database) inserting a record on the subform works
    correctly, adding the foreign key just as expected. I'm in
    communication with Josh to figure out what's different.

    John W. Vinson[MVP]
    Come for live chats every Tuesday and Thursday
    [url]http://go.compuserve.com/msdevapps?loc=us&access=public[/url]
    John Vinson Guest

Similar Threads

  1. Foreign keys tut
    By frizzle in forum MySQL
    Replies: 2
    Last Post: July 18th, 05:45 PM
  2. Sql Import with Foreign Keys
    By ryanmhuc@yahoo.com in forum MySQL
    Replies: 0
    Last Post: May 12th, 08:49 PM
  3. foreign keys - updated
    By Josh in forum Microsoft Access
    Replies: 2
    Last Post: July 24th, 04:01 PM
  4. DMO + Foreign Keys
    By oj in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 8th, 05:58 AM
  5. SQL DMO + Foreign Keys
    By Steven Campbell in forum Microsoft SQL / MS SQL Server
    Replies: 2
    Last Post: July 4th, 09:55 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