Re: Table creation fail

2010-06-25 Thread Prabhat Kumar
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

Re: Table creation fail

2010-06-25 Thread Johan De Meersman
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

Re: Table creation fail

2010-06-25 Thread Prabhat Kumar
Yes, but few exceptions; Column level constraints are applicable to that column only, whereas table level constraints are used to define composite keys like primary key for the combination of two or more columns in a table. column level constraints contain all types of constraints (like, not

Re: Table creation fail

2010-06-24 Thread Joerg Bruehe
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

Table creation fail

2010-06-23 Thread David Stoltz
Hi Folks, I use an online SQL Design tool to design my tables, etc. This generates script code that I can run in phpMySQL to create the tables, etc. The below code is causing an error - see below: CREATE TABLE `testresults` ( `id_employees` INTEGER DEFAULT NULL , `id_test_test`

Re: Table creation fail

2010-06-23 Thread Krishna Chandra Prajapati
Hi, default cannot be used with primary key. mysql CREATE TABLE `testresults` ( - - `id_employees` INTEGER DEFAULT NULL , - `id_test_test` INTEGER DEFAULT NULL , - `testdate` DATE DEFAULT NULL , - `result` VARCHAR( 10 ) DEFAULT NULL , - `resultsdescription` MEDIUMTEXT

Re: Table creation fail

2010-06-23 Thread mos
David, You did not define a primary key for the table. The PRIMARY KEY ( ) is expecting a column name inside the ( ) Mike At 11:21 AM 6/23/2010, David Stoltz wrote: Hi Folks, I use an online SQL Design tool to design my tables, etc. This generates script code that I can run in

RE: Table creation fail

2010-06-23 Thread David Stoltz
creation fail Hi, default cannot be used with primary key. mysql CREATE TABLE `testresults` ( - - `id_employees` INTEGER DEFAULT NULL , - `id_test_test` INTEGER DEFAULT NULL , - `testdate` DATE DEFAULT NULL , - `result` VARCHAR( 10 ) DEFAULT NULL , - `resultsdescription