Well, I guess the only moments when you can verify those conditions are when you insert or delete a project, because it seems logical to me that, at the moment of a department insertion, you will not have any projects related to it, so the constraint you need will automatically be broken.
So,
You can do that. But first you have to do some optimisations, like:
add a column id(bigserial) to the departamens table, after which you will replace the column department with id_department in the projects table. It is an optimisation, as you are dealing with integer, not text.
After
On Tue, 26 Oct 2004, Mike Mascari wrote:
> Stephan Szabo wrote:
> > On Tue, 26 Oct 2004, Mike Mascari wrote:
> >
> >
> >>I'd like to ensure that the creation of a department also implies the
> >>creation of two to eight projects; no more, no less:
>
> >>Is there no way to achieve the above stated
On Tue, 26 Oct 2004, Mike Mascari wrote:
> Stephan Szabo wrote:
> > On Tue, 26 Oct 2004, Mike Mascari wrote:
> >
> >
> >>I'd like to ensure that the creation of a department also implies the
> >>creation of two to eight projects; no more, no less:
>
> >>Is there no way to achieve the above stated
Stephan Szabo wrote:
On Tue, 26 Oct 2004, Mike Mascari wrote:
I'd like to ensure that the creation of a department also implies the
creation of two to eight projects; no more, no less:
Is there no way to achieve the above stated goal in the server? Must I
rely on the application to enforce consis
On Tue, 26 Oct 2004, Mike Mascari wrote:
> I'd like to ensure that the creation of a department also implies the
> creation of two to eight projects; no more, no less:
>
> CREATE TABLE departments (
> department text primary key not null
> );
>
> CREATE TABLE projects (
> project text primary k
Valentin Militaru wrote:
You can do that. But first you have to do some optimisations, like:
add a column id(bigserial) to the departamens table, after which you
will replace the column department with id_department in the projects
table. It is an optimisation, as you are dealing with integer
I'd like to ensure that the creation of a department also implies the
creation of two to eight projects; no more, no less:
CREATE TABLE departments (
department text primary key not null
);
CREATE TABLE projects (
project text primary key not null,
department text not null
references department