Skip to Content
avatar image
Former Member

is it always compulsory to have primary key in the table??

is it always compulsory to have primary key in the table??

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Oct 30, 2012 at 06:42 AM

    Hi Akshay,

    It looks like specifying a primary key is not required while defining a table. I checked it on HANA.

    I didnot specify primary key and created table.

    It will be interesting to think how each row will be considered unique, indexed. Also how the data changes will be handled.

    Thanks,

    Sreejith Balakrishnan

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 15, 2012 at 03:17 PM

    hi

    Basically primary key is used to relate the tables,in future you may come across a situation where you need to get the table contents which you have created ,in those cases the declaration of primary key is

    helpful.

    It is up to you that whether you need the table in future or not.

    it is advisable to declare.

    Regards,

    ASIF.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 12, 2012 at 04:52 AM

    Hi Akshay,

    Primary key are defined in SQL as an UNIQUE constraint with NOT NULL columns.

    Only one set of primary keys is allowed on one table.

    In simple words, primary keys are fields that are unique. it is very much necessary, it helps in uniquely identifying every record in a table.

    Add comment
    10|10000 characters needed characters exceeded