Constraints for grouping

From: PostgreSQL Admin <postgres(at)productivitymedia(dot)com>
To:
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Constraints for grouping
Date: 2007-09-03 18:31:37
Message-ID: 46DC5309.8090604@productivitymedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a question that I've thought in my head about using triggers, but
I figure to ask people that do SQL more than I. So, I have a table that
I want two columns.

(1) A featured column which is for only 1 row, once it switched to
another row than all other rows must be false

title | author_id | categories | featured
--------------------------------+-----------+------+-----
Thierry Beta Release | 3 | 11 | True
Different Approach | 3 | 11 |
Ottawa Does Not Heart Hip-Hop | 3 | 11 |

(2) A featured column by category and only allow category_feature equal
to the number of categories.

Is SQL the way to go (and how - ideas), or should I use python for the
heavy lifting?

Thanks for any input,
J

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Broersma Jr 2007-09-03 20:35:07 Re: Constraints for grouping
Previous Message blay bloo 2007-09-03 18:02:18 Execute SQL statements with 'context'/predefined variables