Got more questions? Find advice on: ASP | XML | Regular Expressions | Windows
in Search
Welcome to SqlAdvice Sign in | Join | Help

Examples in 'Learning SQL' book giving me errors.

Last post 10-12-2007, 7:55 PM by shok. 0 replies.
Sort Posts: Previous Next
  •  10-12-2007, 7:55 PM 35644

    Examples in 'Learning SQL' book giving me errors.

    Hi All,

    When I try the example:

    CREATE TABLE favorite_food
    (person_id SMALLINT UNSIGNED,
    food VARCHAR(20),
    CONSTRAINT pk_favorite_food PRIMARY KEY (person_id, food),
    CONSTRAINT fk_person_id FOREIGN KEY (person_id)
      REFERENCES person (person_id)
    );

    From the book I get the error ERROR 1005 (HY000): Can't create table '.\bank\favorite_food.frm' (errno: 150)

    From the searching I've done I see its related to the foreign key, but since I'm a newb I can't make much sense of whats going on. Is there something wrong with the syntax or what? If someone could put it in simple terms and explain what needs to be changed I'd really appreciate it.

     I've tried on two seperate machines with dif versions of MySQL installed to play it safe, I get the same error on both.

     

    Thanks!
     

View as RSS news feed in XML