Subject Re: [firebird-support] Similar data - common table ?
Author Martijn Tonies

> I have a question about database design and hope to ask here. I need
> to save data about impulses and responses to those impulses. Data
> about impuls is very similar to data of a response. Each response can
> exist only as tight to at least one impuls. Relation between impulses
> and responses is a one-to-many type where one response can belong to
> more impulses.
> Is it ok store similar data (impulses and responses) as rows in a
> common table and distinguish them through one column e.g. Activity =
> 'I' or 'R' ? Is this a good design ? Or is it better to store them in
> separate table ?

In my opinion, this is bad design. Each table should store data
relevant to a single piece of information only.

If "impulse" is not a "response" or "response" is not an "impulse",
they don't be long in the same table at all.

> I thought about primary key being a sequence from generator. In case
> of using common table would this be an unhealthy dependancy for part
> of a row data being dependent on something else then primary key ?

That depends, database design theory tells us we should find a natural
primary key, but in practice, a generated primary key value is much easier
to use (think of Foreign Keys and so on) and instead, a Unique Constraint
on not-nullable columns is used for the potential natural primary key.

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
My thoughts:
Database development questions? Check the forum!