are separate join tables necessary/important like in Filemaker

From: Rounak Jain <rounakjainis(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: are separate join tables necessary/important like in Filemaker
Date: 2017-02-12 15:26:46
Message-ID: CANNuxWOZQ4QrWcRHTiwUnEdTXp_oxntzvcbqxYXEzfXkWFUT-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am new to psql but not databases. I have worked with Filemaker.
I am working on an invoicing database.
The sale_invoice_details table (line item table for sale_invoice) must be
able to retrieve the rate at which the product entered in the current line
was last sold to the current customer. In other words, retrieve rates
customer-wise-product-wise for the current line item.

In Filemaker, it was necessary to create a customer_product_join table with
the following fields:
id_product
id_customer
rate

This table was used to retrieve the previously stored value for that
customer-product.
Every time, a rate was entered manually in the sale_invoice_details table,
a script would update the customer_product_join table.

I am not sure whether such table is required in psql. I think after I am
done with the database, my app must execute queries to retrieve the last
rate for the customer-product. Kindly guide me.

(If the above is unclear, sale_invoice_details table consists of the
following fields:
id_sale_invoice (foreign key of sale_invoice table)
id_product (foreign key of product table)
unit (value to be retrieved from product table)
rate (to be retrieved from customer_product table or via query, I am not
sure))

Sorry, if I still missed to give important details. Kindly inform me so
that I don't repeat my mistake.
Thanks.

Browse pgsql-novice by date

  From Date Subject
Next Message neha khatri 2017-02-13 04:59:34 Regression test : pg_conversion validation
Previous Message David G. Johnston 2017-02-09 16:14:38 Re: What happens to concurrent update to the same row?