pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedBad design or SQL statment quandary
2+ messages / 2 participants
[nested] [flat]
* Bad design or SQL statment quandary
@ 2002-02-27 05:53 grep <cb@onsitetech.com>
2002-02-27 13:21 ` Re: Bad design or SQL statment quandary Bruno Wolff III <bruno@wolff.to>
0 siblings, 1 reply; 2+ messages in thread
From: grep @ 2002-02-27 05:53 UTC (permalink / raw)
To: pgsql-sql
I have 2 tables: 'people' and 'project'. The 'people' table keeps info on
the key players in a project. The 'project' table keep the project info
including the roles the people in 'people' table play. I store the people_id
in the 'project' table. I am at a loss to pull the names from 'people' table
with a SELECT on the project table. So my questions are:
1. what am missing to complete the SELECT?
2. Or is this just bad design on my part? and I should break this info out
to 'roles' table?
Table 'people'
--------------
people_id
name
email
Table 'project'
--------------
proj_id
description
proj_mgr
lead_devel
qa_tester
TIA
--
grep
#!/usr/bin/perl
$_='grep';@a=(g..r,e..p);printf("%c%c%c%c",(y;grep;map;)+70,65,length(join('
;',reverse(split
//,++$_)))+$#a+50,s;mapq;grep\;grep\;grep;+56+y;g;j;+y;r;a;+y;e;p;+y;p;h;);$
_=(split/;/)[0];
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Bad design or SQL statment quandary
2002-02-27 05:53 Bad design or SQL statment quandary grep <cb@onsitetech.com>
@ 2002-02-27 13:21 ` Bruno Wolff III <bruno@wolff.to>
0 siblings, 0 replies; 2+ messages in thread
From: Bruno Wolff III @ 2002-02-27 13:21 UTC (permalink / raw)
To: grep <cb@onsitetech.com>; +Cc: pgsql-sql
On Tue, Feb 26, 2002 at 09:53:06PM -0800,
grep <cb@onsitetech.com> wrote:
> I have 2 tables: 'people' and 'project'. The 'people' table keeps info on
> the key players in a project. The 'project' table keep the project info
> including the roles the people in 'people' table play. I store the people_id
> in the 'project' table. I am at a loss to pull the names from 'people' table
> with a SELECT on the project table. So my questions are:
> 1. what am missing to complete the SELECT?
> 2. Or is this just bad design on my part? and I should break this info out
> to 'roles' table?
>
> Table 'people'
> --------------
> people_id
> name
> email
>
> Table 'project'
> --------------
> proj_id
> description
> proj_mgr
> lead_devel
> qa_tester
>
While role table might be a better way to do things, depending on the
kinds of questions that you ask and whether at some point you might expect
to find multiple people filling the same role on a project, you can get
what you want now.
select name from people, project where proj_id = 'PROJ_ID_YOU WANT' and
(people_id = proj_mgr or people_id = lead_devel or people_id = qa_tester);
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2002-02-27 13:21 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-02-27 05:53 Bad design or SQL statment quandary grep <cb@onsitetech.com>
2002-02-27 13:21 ` Bruno Wolff III <bruno@wolff.to>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox