sqlite3 - How do I design a schema for an order which has both "packages" and "single items"? -


for example, if go mcdonald's can order happy meal and hamburger on same purchase. happy meal collection of items purchased individually (happy meal "package", lack of better word.)

this have far, know customerorderdetail must wrong.

    create table "menu" (     "menuid" integer not null,     "title" text not null,     "sortorder" text not null,     primary key ("menuid") ,     );      create table "singleitem" (     "singleitemid" integer not null,     "name" text,     "menuid" integer,     primary key ("singleitemid") ,     );      create table "customerorder" (     "customerorderid" integer not null,     "date" text,     primary key ("customerorderid")      );      create table "customerorderdetail" (     "customerorderdetailid" integer not null,     "customerorderid" integer,     "sortorder" integer,     "packageid" integer,     "singleitemid" integer,     "quantity" integer,     primary key ("customerorderdetailid") ,     );      create table "package" (     "packageid" integer not null,     "menuid" integer not null,     "packagetypeid" integer not null,     "datemodified" date not null,     primary key ("packageid") ,     );      create table "packagedetail" (     "packagedetailid" integer not null,     "packageid" integer not null,     "singleitemid" integer not null,     "singleitemorder" integer not null,     primary key ("packagedetailid") ,     );      create table "packagetype" (     "packagetypeid" integer not null,     "name" text,     "sortorder" integer,     "note" text,     primary key ("packagetypeid")      ); 

imgur link diagram


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -