Skip to Content
avatar image
Former Member

How many primary keys for one table?can we add more primary keys

In general Table have one primary key.is it possible to more than one primary key in a table?(ie is it possible to add more than one pirmary key in a table). Help me out.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

8 Answers

  • avatar image
    Former Member
    Jul 01, 2008 at 03:54 AM

    This message was moderated.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 01, 2008 at 04:00 AM

    What Kind of table ? a Data base table or a Internal table ?

    Well in both types of table, you can have more than one primary key ..

    Boobalan .. you are wrong here ..

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 01, 2008 at 04:17 AM

    Hi,

    a unique key or primary key is a candidate key to uniquely identify each row in a table. A unique key or primary key comprises a single column or set of columns. No two distinct rows in a table can have the same value (or combination of values) in those columns. Depending on its design, a table may have arbitrarily many unique keys but at most one primary key.

    A primary key is a special case of unique keys. The major difference is that for unique keys the implicit NOT NULL constraint is not automatically enforced, while for primary keys it is. Thus, the values in a unique key columns may or may not be NULL. Another difference is that primary keys must be defined using another syntax.

    Hope it is clear.

    Reward points if useful.

    Best Regards,

    Sekhar

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 01, 2008 at 04:50 AM

    Hi,

    A table has only one primary key. This is correct but how many columns form this primary key depends on the table.

    So from your question I am not sure what is your concern.

    If you concern is to have more than one primary key this is not possible.

    If your concern is to have more than one filed to be a part of the primary key, then surely this is possible.

    I hope this clarifies your answer.

    Regards,

    Saurabh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 01, 2008 at 09:13 AM

    Hello Kishore,

    You can include N no. of fileds as primary key in your table. It will act as a complex primary key.

    suppose you have 10 fields in your table. you can declare all the 10 filelds as a primary key. you can not have the two records with the same combination of the primary keys.

    Hope this will clarify your query.

    reward if helpfull.

    Regards,

    Naresh.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 02, 2008 at 04:18 AM

    Hi,

    you can have more than one key field as primary key.

    EXAMPLE

    VBAP,VBEP

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 02, 2008 at 09:16 AM

    15 primary keys are possible for a table

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 02, 2008 at 11:56 AM

    Yes ,it is possible to have more then 1 primary key.In that case it is said to be composite primary key.

    thanks

    Lokesh Tripathi

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      John's answer is absolutly correct. There is a limit for fields in primary key by the database system. The limit is 16 fields, or 15 if you have to use also the CLIENT (client-specific tables).

      Regards,

      André Klos