Here are the problems I can see in theProductType create table:
  • A stray closing parentheses
  • The column 'group', used in the foreign key constraint, does not exist in table ProductType
  • The name 'group' is a reserved word anyway


Here's a working one with the foreign key as a table constraint:
Qt Code:
  1. CREATE TABLE ProductType(
  2. id INTEGER PRIMARY KEY AUTOINCREMENT,
  3. name TEXT,
  4. low_level INTEGER,
  5. prod_group INTEGER NOT NULL,
  6. FOREIGN KEY (prod_group) REFERENCES ProductTypeGroup(id)
  7. );
To copy to clipboard, switch view to plain text mode 
or as a column constraint:
Qt Code:
  1. CREATE TABLE ProductType(
  2. id INTEGER PRIMARY KEY AUTOINCREMENT,
  3. name TEXT,
  4. low_level INTEGER,
  5. prod_group INTEGER NOT NULL REFERENCES ProductTypeGroup(id)
  6. );
To copy to clipboard, switch view to plain text mode