Tables

These tables are created in the Postgres database:

  • Orders
  • Orderlines

To create the tables, run this code:

CREATE SEQUENCE g_orders_id;

CREATE TABLE orders
(
  ordernumber character varying(20) NOT NULL,
  orderstatus character varying(20),
  orderdatetime timestamp with time zone,
  customer character varying(20),
  lastmodification timestamp with time zone,
  CONSTRAINT orders_pkey PRIMARY KEY (ordernumber)
);

CREATE TABLE orderlines
(
  ordernumber character varying(20) NOT NULL,
  linenumber integer NOT NULL,
  item character varying(20),
  quantity integer,
  price numeric(18,2),
  CONSTRAINT orderlines_ordernumber_fkey FOREIGN KEY (ordernumber)
      REFERENCES orders (ordernumber) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
);