You need to create the Kunde table before the |RESERVIERUNG table. Otherwise it can't create the foreign key (because the table doesn't exist).

|
On 15/10/2015 6:04 PM, Steve McLeod wrote:
Two things I can suggest:

1) You should ask this question on stackoverflow.com, not in this mailing list.
2) You should post the full error you get (on stackoverflow.com)


On Thursday, 15 October 2015 05:42:59 UTC+2, DBDude wrote:

    Hi!

    I have a problem with creating tables:
    |CREATE TABLE BOX
    (BID int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    Groesse int,
    Einstreu varchar(50),
    Ort varchar(50),
    Fenster boolean,
    Preis int,
    Bild varchar(50));

    CREATE TABLE RESERVIERUNG
    (RID int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
    KID int FOREIGN KEY REFERENCES KUNDE(KID) ,
    BID int FOREIGN KEY REFERENCES BOX(BID),
    Anfang date,
    Ende date,
    Pferd varchar(50),
    );


    CREATE TABLE Kunde
    (KID int GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
     Name varchar(50),
     HatKundenKarte boolean,
    );|

    When I execute this sql statement I cant create the table
    'reservierung' . There seems to be a problem with the 'foreign key
    references' command.
    I used this code with HSQLDB a while ago and it worked. Does
    anyone know what is wrong with the code?

--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to