Results 1 to 4 of 4

Thread: Primary key and foreign key differentiation

  1. #1
    Join Date
    Nov 2009
    Posts
    83

    Primary key and foreign key differentiation

    Hi Guys ,

    I am just started to learn the SQL . You know there are various keys like primary fey, unique key are used in the SQL. I have little-bit knowledge about the primary key but don't know in detail.

    Is anybody know about "Primary key and foreign key differentiation" ?

  2. #2
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Primary key and foreign key differentiation

    Hi friends,

    1. In a single table there is only foreign key you can use . On other hand you can use more than one foreign keys in a single table.

    2. Primary key from one table is the foreign key for the another table. Primary key is must not be repeated in the same table.

    2.You can not assign "null value" to the primary key of the table.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Primary key and foreign key differentiation

    Following are some differentiation between Primary key and foreign key:

    1. A primary key is a field value or combination of fields values which is useful to identify a record from the table uniquely.

    2. The advantage of the foreign key is that it enables the methods for referencing other table through the primary key of that table.

    3. You are able to locate individual record through the "Primary key". "Foreign key" is works as referencing key for the different tables

    4. "Primary key" don't have any duplicate value for the field ,while "Foreign key" may have duplicate value for the same field.

  4. #4
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Primary key and foreign key differentiation

    Hi Friend,

    Please go through the below some information regarding Primary key and foreign key:

    *. Primary key is useful in identifying a row of the table as well as it doesn't comprises "null values". And this property of the Primary key is useful to prevent rows duplication.

    *. Foreign key is useful in identifying a column of the table and can comprises "null values"

    *. In the Relational database concepts , a foreign key works as a
    referential constraint among the two different tables.

Similar Threads

  1. Is there any foreign invasion in Sengoku?
    By land Bald in forum Video Games
    Replies: 6
    Last Post: 13-09-2011, 11:27 PM
  2. Differentiation between XML and PHP
    By Gokul20 in forum Software Development
    Replies: 5
    Last Post: 10-03-2010, 03:43 PM
  3. Differentiation between WAN and LAN
    By Dolsy_bendal in forum Networking & Security
    Replies: 4
    Last Post: 30-11-2009, 10:46 AM
  4. When to use foreign keys ?
    By Balgovind in forum Software Development
    Replies: 4
    Last Post: 21-04-2009, 12:11 PM
  5. Replies: 2
    Last Post: 03-06-2008, 03:16 PM

Tags for this Thread

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
  •  
Page generated in 1,751,661,289.97750 seconds with 16 queries