List:General Discussion« Previous MessageNext Message »
From:Prabhat Kumar Date:June 25 2010 6:10am
Subject:Re: Table creation fail
View as plain text  
Correct,
a primary key is used to uniquely identify each row in a table. It can
either be part of the actual record itself , or it can be an artificial
field (one that has nothing to do with the actual record).
A primary key can consist of one or more fields on a table. When multiple
fields are used as a primary key, they are called a composite key.

A Primary key constraint can be defined at various levels:

    * Primary key constraint defined at column level
                      Syntax: <Column Name> <datatype>(<size>) Primary
Key
    * Primary key constraint defined at table level
                     Syntax: Primary key (<Column Name>, <Column Name>)

--Prabhat



On Thu, Jun 24, 2010 at 3:03 PM, Joerg Bruehe <Joerg.Bruehe@stripped> wrote:

> Hi David, all!
>
>
> David Stoltz wrote:
> > Actually,
> >
> >
> >
> > That table isn't supposed to have a PK, so I removed that, and it
> > works...same effect you suggested.
>
> Even if you currently don't need a primary key in that table, IMO you
> should still define one. Use some 'id_testresult' column with an
> autoincrement clause, so you need not provide a value.
>
> Sooner or later you may (I really think: will) feel the need to uniquely
> identify a row, especially to delete it, and a primary key will be very
> helpful then.
>
> Your original problem was most likely not due to mentioning "primary
> key" but rather to not providing a column name for it.
>
>
> Regards,
> Jörg
>
> --
> Joerg Bruehe,  MySQL Build Team,  Joerg.Bruehe@stripped
> Sun Microsystems GmbH,   Komturstrasse 18a,   D-12099 Berlin
> Geschaeftsfuehrer: Juergen Kunz
> Amtsgericht Muenchen: HRB161028
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=1
>
>


-- 
Best Regards,

Prabhat Kumar
MySQL DBA
Datavail-India Mumbai
Mobile     : 91-9987681929
www.datavail.com

My Blog: http://adminlinux.blogspot.com
My LinkedIn: http://www.linkedin.com/in/profileprabhat

Thread
Table creation failDavid Stoltz23 Jun
  • Re: Table creation failKrishna Chandra Prajapati23 Jun
    • RE: Table creation failDavid Stoltz23 Jun
      • Re: Table creation failJoerg Bruehe24 Jun
        • Re: Table creation failPrabhat Kumar25 Jun
          • Re: Table creation failJohan De Meersman25 Jun
            • Re: Table creation failPrabhat Kumar25 Jun
  • Re: Table creation failmos23 Jun