Re: [SQL] Constraints for grouping

2007-09-03 Thread PostgreSQL Admin
> --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > >> CREATE UNIQUE INDEX Only_one_row_true >> ON Your_table ( featured ) >>WHERE featured = true; >> >> Or if you want to only allow 1 featured article per catagory then: >> >> CREATE UNIQUE INDEX Only_one_row_true_per_catag

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
OOPS! --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > CREATE UNIQUE INDEX Only_one_row_true > ON Your_table ( featured ) >WHERE featured = true; > > Or if you want to only allow 1 featured article per catagory then: > > CREATE UNIQUE INDEX Only_one_row_true_per_catagory >

Re: [SQL] Constraints for grouping

2007-09-03 Thread Richard Broersma Jr
--- PostgreSQL Admin <[EMAIL PROTECTED]> wrote: > 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 > anoth

[SQL] Constraints for grouping

2007-09-03 Thread PostgreSQL Admin
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

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two attributes on

2001-10-12 Thread Lee Harr
> I was looking for a solution on how to write a constraint into a ' create > table ' expression that would ensure that one ' TIME ' attribute value > called arrival_time (declared as TIME) is allways constrained to have a > value that ensures it is allways after another attribute value called > d

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two

2001-10-05 Thread Peter Eisentraut
Maher, Christopher W writes: > I was looking for a solution on how to write a constraint into a ' create > table ' expression that would ensure that one ' TIME ' attribute value > called arrival_time (declared as TIME) is allways constrained to have a > value that ensures it is allways after anot

Re: [SQL] SQL CONSTRAINTS - Constraining time values from two attributes on a table.

2001-10-05 Thread Josh Berkus
Chris, > Hi, > I was looking for a solution on how to write a constraint into a ' > create > table ' expression that would ensure that one ' TIME ' attribute > value > called arrival_time (declared as TIME) is allways constrained to have > a > value that ensures it is allways after another attrib

[SQL] SQL CONSTRAINTS - Constraining time values from two attributes on a table.

2001-10-05 Thread Maher, Christopher W
Hi, I was looking for a solution on how to write a constraint into a ' create table ' expression that would ensure that one ' TIME ' attribute value called arrival_time (declared as TIME) is allways constrained to have a value that ensures it is allways after another attribute value called departu

[SQL] constraints,

2001-06-22 Thread jeff
Hello folks, wondering how to display any constraints that a table may have, as well i know alter table add constraint works, but what's the syntax to remove one ? i assume /alter table remove constraint, but i can't find any examples. jeff ---(end of broadcast)--

Re: [SQL] Constraints...

2001-05-12 Thread Stephan Szabo
Yes. It depends on what exactly you want for the update/delete cases on permissions. I believe that in any cases you can use the check function that's used by the fk implementation to do the insert/update check on objects. If you don't mind update/deletes on permission failing if the row being

[SQL] Constraints...

2001-05-12 Thread Michael Richards
Does anyone know how I can make a constraint on a key to enforce a 1 to n relationship where n>0? I've invented an example to show the sort of constraint I need: CREATE TABLE permissions ( id int4, userid int4, perm int4, primary key (id,userid) ); CREATE TABLE objects ( id int4, per