Advertisement
Guest User

Billing app database

a guest
Dec 9th, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. CREATE TABLE public.product(
  2.     id SERIAL PRIMARY KEY,
  3.     name text NOT NULL,
  4.     bar_code text
  5. );
  6.  
  7. CREATE TABLE public.store(
  8.     id SERIAL PRIMARY KEY,
  9.     name text NOT NULL
  10. );
  11.  
  12. CREATE TABLE public.price(
  13.     id SERIAL PRIMARY KEY,
  14.     id_product integer NOT NULL REFERENCES public.product(id),
  15.     id_store integer NOT NULL REFERENCES public.store(id),
  16.     price float NOT NULL
  17. );
  18.  
  19. CREATE TABLE public.receipt(
  20.     id SERIAL PRIMARY KEY,
  21.     id_store integer NOT NULL REFERENCES public.store(id)
  22. );
  23.  
  24. CREATE TABLE public.receipt_price(
  25.     id_receipt integer NOT NULL REFERENCES public.receipt(id),
  26.     id_price integer NOT NULL REFERENCES public.price(id)
  27. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement