View Single Post
  #3  
Old April 29th, 2004, 04:37 AM
Paul
external usenet poster
 
Posts: n/a
Default Table Design for Operating Permit

Based on your sample report you would want to setup up
your tables in the following manner, note: it is possible
to have a primary key consisting of multiple attributes

Process (ProcessID, ProcessDescription) primary key:
ProcessID
System (SystemID, SystemDescription) primary key: SystemID
Device (DeviceID, DeviceDescription) primary key: DeviceID
Conditions (ConditionID, ConditionDescription) primary
key: ConditionID
SystemProcesses (ProcessID, SystemID) primary key
(ProcessID, SystemID)
DeviceConditions (DeviceID, ConditionID) primary key
(DeviceID, ConditionID)
SystemDevices (SystemID, DeviceID) primary key (SystemID,
DeviceID)

The following query will give you all the information you
need to know. It can be modified to give you specific
fields and conditions can be added to limit the records
returned.

SELECT ProcessID, ProcessDescription, SystemID,
SystemDescription, DeviceID, DeviceDescription,
ConditionID, ConditionDescription
FROM Process, System, Device, Conditions,
SystemProcesses, DeviceConditions, SystemDevices
WHERE Process.ProcessID=SystemProcesses.ProcessID AND
System.SystemID=SystemProcesses.SystemID AND
System.SystemID=SystemDevices.SystemID AND
Device.DeviceID=SystemDevices.DeviceID AND
Device.DeviceID=DeviceConditions.DeviceID AND
Conditions.ConditionID=DeviceConditions.ConditionI D

-----Original Message-----
I have a project where I need to maintain an operating

permit for a
client. The permit has the following format:

Process 1 - Engines

System 1 - Emergency Power

Device D1
Conditions 1-1, 2-1

Device D2
Conditions 1-1

System 2 - Cogeneration

Device D3
Conditions 3-1, 3-2, 3-3

Device D4
Conditions 3-1, 3-2

The process and system numbers are unique. The device

numbers are
also unique - i.e. there can only be one device D1.

The conditions are also unique. There can only be one

condition with
the ID 3-1.

As you can see, however, a device can have multiple

conditions. A
condition can also be used for multiple devices.

Unfortunately, the agency that oversees these operating

permits does
not have a way to issue the permits in pieces. If I

want to see all
equipment in system 2, or if I want to see all equipment

that is
subject to condition 3-2, there's no easy way to view it.

The fields are all pretty much text based.

I'm looking for some input in the table design.

It seems to me that I could have the following tables

and fields:

1. Process (ProcessID, ProcessDescription)

2. System (SystemID, SystemDescription)

3. Device (DeviceID, DeviceDescription)

4. Conditions (ConditionID, ConditionDescription)

All the ID fields would be the primary keys. The

Description fields
would be text.

I would need a fifth table and that's the table whose

design I'm
asking for help on. Would I simply create some sort of

composite
table in the following format:

5. Composite (CompositeID, ProcessID, SystemID,

DeviceID,
ConditionID)

The composite ID would be the primary key and all the

other fields
would be foreign keys. It seems to me that I could then

create
reports and queries to display the permit in the various

formats as
needed.

Thanks in advance for you help.
.