The latter seems to be good.
> On Feb 1, 3:45 am, "Frank" <D
@reply.to.me> wrote:
>> I need a way to represent the RESOURCES.
>> For example, employee and machines are resources. I create two tables
>> named
>> employee (EID as PK) and machine(MID as PK). and create a view named
>> Resource (RID as key) as followed,
>> create view Resource as
>> select EID RID, name
>> from Employee
>> union all
>> select MID, name
>> from machine
>> It's great for me since now.
>> However, if another table refer to RID, I cannot create a FK reference
>> for
>> it because Resource is a view but not a table.
>> What I mean is,
>> +------------+ +------------+
>> | Resource |--------------------| TABLE |
>> +------------+ +RID +-------------+
>> So, how to represent the RESOURCES?
>> Thanks
>> ---Frank Lee
> Frank,
> Try reorganizing your table like this
> Resource
> ========
> RID RNAME RTYPE
> 01 empl1 EMP
> 02 empl2 EMP
> 03 mach1 PC
> 04 mach2 PC
> (or)
> If Re-organazing is not feasable
> create a third table
> EMP_TABLE
> ========
> 01 empl1
> 02 empl2
> PC_TABLE
> =======
> MID MNAME
> 01 mach1
> 02 mach2
> Resource
> ========
> RID Machid-Empid RType
> 01 01 EMP
> 02 02 EMP
> 03 01 PC
> 04 02 PC