Re: constrains on two tables - Mailing list pgsql-general

From finecur
Subject Re: constrains on two tables
Date
Msg-id 1189616743.228233.214700@y42g2000hsy.googlegroups.com
Whole thread Raw
Responses Re: constrains on two tables  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-general
On Sep 10, 9:55 pm, finecur <fine...@yahoo.com> wrote:
> Hi
>
> Here is my table:
>
> Table School
> (
>     id integer,
>     name text
> );
>
> Table Department
> (
>     id integer,
>     school_id integer reference school(id),
>     name text
> );
>
> Table Course
> (
>     department_id integer references department(id),
>     name text,
>     course_number text
> )
>
> I would like to make the course_number unique, but not in the course
> table, nor in department. I would like to make the course_number
> unique in the scope of School. So, you may see the same course_number
> in Course table, but (school_id, course_number) should be always
> unique. How can I make the constrain?
>
> Thanks,
>
> ff

Anyone know???


pgsql-general by date:

Previous
From: Jason Nerida
Date:
Subject: su: adduser: command not found mac osx
Next
From: Max
Date:
Subject: Re: arrays of foreign keys