Creating a limits table

From: Kurt R Marquardt <marqkdsade(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Creating a limits table
Date: 2016-04-05 12:14:31
Message-ID: CABtkwHW994WY+c=ZBKu7_S9TKBJ_ANpvyoVMhgvDjZd761DxdQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have a DB with 200+ categories and 3500+ products. There are two
columns in the product category 'model' and 'top_model'. The 'model' is
the SKU (top_model with attributes). An example would be a tee shirt
'top-model' AB101; 'model' AB101-sm-blue. So if it came in 4 different
sizes and 4 different colors there would be 16 'models' with 1
'top_model'. I am wondering if I should build a look-up table with two
columns 'top_model' and 'model_limit' to create a limit boundary.

qty_table

top_model | model_limit
-----------------|------------------
AB101 | 16

This would only need to be accessed where 'model' <> 'top_model'.

If 'model' = 'top_model' limit '1' else limit = model_limit from qty_table
where 'top_model' = 'AB101'.

Yes, I am aware the syntax isn't accurate, just trying for brevity.

It seems it would be quite easy to parse the products table to build this
fairly quickly.

Thank you for any and all feedback.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message David G. Johnston 2016-04-05 19:18:38 Re: Creating a limits table
Previous Message Kevin Grittner 2016-04-04 21:34:35 Re: unrecognized configuration parameter "autocommit"