adding records to tables

Results 1 to 2 of 2

Thread: adding records to tables

  1. #1
    Join Date
    Dec 1969

    Default adding records to tables

    HI,<BR><BR>By looking at this <BR><BR><BR>I wonder what is foreign key and how to add so that the Players.TeamID and Teams.TeamID will match.<BR><BR>THanks<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default primary and foreign keys...

    You *really* should simply go read the HELP for whatever DB you are using. Look up those terms. Such as in Access.<BR><BR>But an example, showing two tables and their fields and the type of each field:<BR><BR>TABLE: Teams<BR> teamID : autonumber, primary key<BR> teamName : text<BR> teamManager : number, foreign key to Players table!<BR> ...<BR><BR>TABLE: Players<BR> playerID : autonumber, primary key<BR> teamID : number, foreign key to Teams table<BR> playerName : text<BR> playerPosition : text<BR> playerPhone : text<BR> ...<BR><BR>All "foreign key" applied to a field means is that this field contains a value that matches a "primary key" in another table.<BR><BR>All "primary key" means is that you are guaranteed that there are no duplicates of that key in the table (which is why an autonumber field is a good choice for primary key, as the DB ensures that each record gets a different autonumber value).<BR><BR>Anyway, primary and foreign keys are *the* most fundamental of the building blocks of relational databases. And until you understand and use them, you aren&#039;t *really* using databases, at all. (Without relationships, a single table in a database is no more powerful than a spreadsheet table--and less so in many ways.)<BR><BR>

Posting Permissions

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