CREATE TABLE payoutpercentage (
productgroup  VARCHAR2(5),
position      NUMBER(1),
payoutpct     NUMBER(3))
PCTFREE 0
PCTUSED 99;

BEGIN
  INSERT INTO payoutpercentage VALUES ('ACC', 0, 5);
  INSERT INTO payoutpercentage VALUES ('ACC', 1, 10);
  INSERT INTO payoutpercentage VALUES ('ACC', 2, 15);
  INSERT INTO payoutpercentage VALUES ('ACC', 3, 20);
  COMMIT;
END;
/

CREATE TABLE accessoryhistory (
dbid       VARCHAR2(1) DEFAULT ('W'),
statustype VARCHAR2(3),
sku        VARCHAR2(21),
quantity   NUMBER(10,0) DEFAULT 1,
saleprice  NUMBER(19,4) DEFAULT 0,
compdate   DATE DEFAULT SYSDATE,
store      NUMBER(10,0) DEFAULT 0)
PCTFREE 0
PCTUSED 99;

BEGIN
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'ABCD', 6, 100, SYSDATE, 2);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', '987B', 3, 100, SYSDATE, 1);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'ABCD', 1, 100, SYSDATE, 3);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'RXRX', 2, 100, SYSDATE, 3);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'ABCD', 9, 100, SYSDATE, 2);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'QV23', 7, 100, SYSDATE, 1);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'ABCD', 1, 100, SYSDATE, 4);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'QV23', 3, 100, SYSDATE, 5);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'ABCD', 2, 100, SYSDATE, 2);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'RXRX', 1, 100, SYSDATE, 4);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'RXRX', 1, 100, SYSDATE, 5);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'QV23', 3, 100, SYSDATE, 1);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', '987B', 1, 100, SYSDATE, 2);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'ABCD', 3, 100, SYSDATE, 1);
  INSERT INTO accessoryhistory VALUES ('W', 'ACT', 'RXRX', 4, 100, SYSDATE, 2);
  INSERT INTO accessoryhistory VALUES ('W', 'DEA', 'QV23', 3, 100, SYSDATE, 3);
  COMMIT;
END;
/

CREATE TABLE store (
store      NUMBER(10,0) DEFAULT 0,
name       VARCHAR2(60),
areadir    NUMBER(10,0) DEFAULT 0,
areamgr    NUMBER(10,0) DEFAULT 0,
storemgr1  NUMBER(10,0) DEFAULT 0,
storemgr2  NUMBER(10,0) DEFAULT 0,
asstmgr1   NUMBER(10,0) DEFAULT 0,
asstmgr2   NUMBER(10,0) DEFAULT 0,
asstmgr3   NUMBER(10,0) DEFAULT 0);

BEGIN
  INSERT INTO store VALUES (1, 'San Francisco', 100, 200, 301, 302, 401, 402, 403);
  INSERT INTO store VALUES (2, 'Denver', 131, 225, 310, 0, 447, 407, 0);
  INSERT INTO store VALUES (3, 'Chicago', 155, 222, 311, 354, 401, 402, 403);
  INSERT INTO store VALUES (4, 'London', 178, 0, 301, 0, 377, 402, 403);
  INSERT INTO store VALUES (5, 'Ankara', 0, 298, 301, 390, 401, 402, 403);
  COMMIT;
END;
/

CREATE TABLE sku (
dbid          VARCHAR2(1) DEFAULT ('W'),
sku           VARCHAR2(21),
productgroup  VARCHAR2(5) DEFAULT ('ACC'),
name          VARCHAR2(30));

BEGIN
  INSERT INTO sku VALUES ('W', 'ABCD', 'ACC', 'Phone');
  INSERT INTO sku VALUES ('W', 'RXRX', 'ACC', 'Microphone');
  INSERT INTO sku VALUES ('W', 'QV23', 'ACC', 'Speaker');
  INSERT INTO sku VALUES ('W', '987B', 'ACC', 'Bracket');
  INSERT INTO sku VALUES ('C', 'ABCD', 'ACC', 'Antenna');
  COMMIT;
END;
/
