Re: Foreign key constraint problem

2005-06-14 Thread Marcus Bointon
On 14 Jun 2005, at 17:52, [EMAIL PROTECTED] wrote: My suggestion, lame as it is, would be to use a 0 (zero) in place of the NULL value. That way, you always have a valid entry for PARENT_ID, you can still identify the tops of the trees (parent_id=0) and you have gotten around the only-one-pa

Re: Foreign key constraint problem

2005-06-14 Thread SGreen
Marcus Bointon <[EMAIL PROTECTED]> wrote on 06/14/2005 12:37:18 PM: > I have a table that uses a self join to represent simple hierarchies. > I have a parent_id field that contains a reference to the same > table's id field. Not all items have a parent, so parent_id is nullable. > The problem I

RE: Foreign key constraint problem

2005-06-14 Thread Gordon Bruce
- From: Marcus Bointon [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 11:37 AM To: mysql@lists.mysql.com Subject: Foreign key constraint problem I have a table that uses a self join to represent simple hierarchies. I have a parent_id field that contains a reference to the same table&

Foreign key constraint problem

2005-06-14 Thread Marcus Bointon
I have a table that uses a self join to represent simple hierarchies. I have a parent_id field that contains a reference to the same table's id field. Not all items have a parent, so parent_id is nullable. The problem I run into is in defining the foreign key constraint - if a parent item i

re: foreign key constraint problem

2003-03-20 Thread Victoria Reznichenko
On Saturday 15 March 2003 04:08, vishnu mahendra wrote: > create table stud(rno integer not null, > name char(10), > primary key(rno)); > > create table mark(rno integer not null references > stud, > mark integer); [skip] > how is it possible. > there is no rollno 3 in the stud table, > then how

foreign key constraint problem

2003-03-14 Thread vishnu mahendra
foreign key constraint problem: --- create table stud(rno integer not null, name char(10), primary key(rno)); create table mark(rno integer not null references stud, mark integer); mysql> insert into stud values(1,'a'); Query OK, 1 row affected (0.2