From: fredt <fr...@us...> - 2008-02-29 16:49:26
|
You need to create a unique constraint or primary key on “Event Description Table1” (“ID”) before creating the foreign key. Fred ----- Original Message ----- From: <Mur...@qu...> To: <hsq...@li...> Sent: 29 February 2008 15:11 Subject: [Hsqldb-user] Relationships Greetings I am trying to create a simple relational database composed of three tables. The first table (Employee Table1) contains 18 fields. The second table (Event Table1) contains 16 fields. The third table (Event Description Table1) contains 5 fields. I’m using Open Office 2.3.1 and what should be the current version of HSQLDB embedded. The computer operating system is Windows XP version 2002 with Service Pack 2. This is a nearly new Dell laptop, but I’m actually running the file from a server on our corporate network. I managed to create the desired one-to-many relationship between ‘Employee Table1’ (using the primary key) and ‘Event Table1’ (using an integer key field in the table.) But I also wanted to relate ‘Event Description’ to ‘Events’ using the primary key in ‘Event Description’ and another integer key in ‘Events’ So I have three tables – two of which would be parents to the third. I used the ‘Relationships’ GUI in Open Office Base, and I got the following error: Integrity constraint violation – no parent 0, table: Event Table1 in statement [ALTER TABLE “Event Table1” ADD FOREIGN KEY (“Event Key”) REFERENCES “Event Description Table1” (“ID”)] I tried entering the above SQL statement directly into HSQLDB using the Base SQL command box - and got the same result. I’m not overly conversant with SQL, HSQLDB or BASE, but at the moment I’m at a virtual standstill. I’ve tried everything I can think of. My next option is to try to begin again with other software. Can anyone give me a clue? Many Thanks Murray ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Hsqldb-user mailing list Hsq...@li... https://lists.sourceforge.net/lists/listinfo/hsqldb-user |