X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 056BDD1B19F for ; Mon, 14 Jun 2004 12:16:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 34275-06 for ; Mon, 14 Jun 2004 15:16:04 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id D926BD1B27A for ; Mon, 14 Jun 2004 12:16:02 -0300 (ADT) Received: (qmail 9009 invoked by uid 500); 14 Jun 2004 15:22:02 -0000 Date: Mon, 14 Jun 2004 10:22:02 -0500 From: Bruno Wolff III To: sathish Cc: pgsql-jdbc@postgresql.org Subject: Re: [ADMIN] doubt Message-ID: <20040614152202.GA8883@wolff.to> References: <40C97EE7.8030901@ceedees.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <40C97EE7.8030901@ceedees.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200406/49 X-Sequence-Number: 10251 On Fri, Jun 11, 2004 at 15:14:07 +0530, sathish wrote: > dear groups, > i have a doubt in sql, > i have a table staff_skills in which i have set a table level > constraint to create a primary key of two fields . > so 'name' and 'skill' combinedly forms a primary key. > now the issue is in another table i have only 'name' field and i want > to create a foreign key constraint which refers the staff_skills table's > 'name' field only. No. References need to be to keys (columns with a unique index on just the columns being referenced). In this case you almost certainly what to have the name table separate from the skill table and have both the skill table and the other table refer to the name table. > staff_skills (table) - name,skill,ability (columns) --- primary > key(name,skill) > staff_xxxx (table) - name,x,y,z (columns) --- foreign > key(name) references staff_skills(name). > how to do the above? > your immediate reply will be helpful > yours sincerely > SathishKumar.S