Alpha DevCon 2018
Results 1 to 5 of 5

Thread: Auto increment for Foreign Key

  1. #1
    Member
    Real Name
    George R. Kenney
    Join Date
    Jul 2005
    Posts
    144

    Default Auto increment for Foreign Key

    Is the foreign key represented as an auto increment field in the associated child table? I don't know whether to make it an auto increment field in the associated table or not given that it is an auto increment field in the parent table. I know this is really basic but I don't seem to get anything clear if I google it sorry? I suppose this is obvious to everyone else.

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,854

    Default Re: Auto increment for Foreign Key

    You do not want to make the linking field autoincrement in the child table(s). Alpha assigns the linking key value as child records are added in the context of the set.
    There can be only one.

  3. #3
    Member
    Real Name
    George R. Kenney
    Join Date
    Jul 2005
    Posts
    144

    Default Re: Auto increment for Foreign Key

    Thats the way I have it but I was not sure if that was a problem or not. Thank you so much for your advice. I am using a postgres sql database as a backend

  4. #4
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,854

    Default Re: Auto increment for Foreign Key

    Another way of thinking about it is that if you had the linking field autoincrement in the child table you could never have multiple child records for a given parent record.
    There can be only one.

  5. #5
    Member
    Real Name
    George R. Kenney
    Join Date
    Jul 2005
    Posts
    144

    Default Re: Auto increment for Foreign Key

    Well the way I thought about it was that if the parent field auto incremented then the child would just reflect that field in the parent and If I made the child autoi ncrement I would get a conflict of numbers. anyway I appreciate the feedback and advice I never saw anything about it I suppose because everyone already knows all this. So know I am clear. I was worried I was doing something wrong.
    Thanks

Similar Threads

  1. auto increment
    By rreining in forum Application Server Version 8
    Replies: 3
    Last Post: 09-14-2008, 11:03 PM
  2. Auto Increment
    By Eliot Godfrey in forum Alpha Five Version 6
    Replies: 5
    Last Post: 05-23-2005, 12:03 PM
  3. Auto Increment
    By Phil Rolf in forum Alpha Five Version 6
    Replies: 30
    Last Post: 02-11-2005, 05:50 PM
  4. Auto Auto-Increment Field
    By Ken McEntee in forum Alpha Five Version 5
    Replies: 8
    Last Post: 05-12-2004, 12:12 PM
  5. Auto Increment
    By Rich Rollock in forum Alpha Five Version 5
    Replies: 5
    Last Post: 04-30-2004, 07:29 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
  •