Re: database design.. question

From: Lennart Jonsson <lennart_at_kommunicera.umea.se>
Date: 16 May 2002 12:56:26 -0700
Message-ID: <6dae7e65.0205161156.66b29b14_at_posting.google.com>


Lukasz Giermek <lukasz_at_elterix.pl> wrote in message news:<3CE3A80D.E75EA725_at_elterix.pl>...
> Hi,
> well, the problem is that one event can have an assigment to many people
> and each time this could be different group of people..
>
>
> > Why not stick with the simple and have one table for each individual
> > employee,
> > and allocate a unique ID to the table. Then have a separate table for
> > event
> > details, with one of the columns being the employee_id. Or have I
> > misunderstood your question?
> >
> > Omar

something like

create table persons (

	person_id integer not null,
	firstname char(20),
	...,
	constraint xpkpersons primary key (id)

)

create table events (

	event_id integer not null,
	event_time timestamp not null,
	description char(100),
	constraint xpkevents primary key (id)

)

create table participants (

	person_id integer not null,
	event_id  integer not null,
	constraint xpkparticipants primary key (person_id, event_id),
	constraint xfk1participants foreign key (person_id)
		references persons on delete cascade,
       constraint xfk1participants foreign key (event_id)
		references events on delete cascade

)

will do if each person can participate only once in each event

Hope it helps
/Lennart Received on Thu May 16 2002 - 21:56:26 CEST

Original text of this message