Hello I am designing a database to keep track of Landlords Properties and Tenants.
I am struggling to think how best to set up the relationships between the tables.
The basics are that ONE Landlord may have MANY properties and ONE Property may have many Tenants over time - but only one active Tenant at any time.
I have set the following ID's in each table.
Landlords - LAN_ID
Properties - PROP_ID
Tenants - TEN_ID
At first I thought the method below was the way to go:
LAN_ID > (one to many) > PROP_ID > (one to many) > TEN_ID
The problem with this approach is that I want to ensure that there is no risk of old tenants showing in forms and potentially the user applying data to the wrong tenant.
I then considered having a field in the Properties table called Ten_ID_Link, into which I could input the Ten_ID. I can make this field indexed so that a ten_ID would only appear once in the table and thus ensure that only one tenant is ever bound to a property. ie.
LAN_ID > (one to many) > PROP_ID
PROP_TENANT_ID_LINK > (one to one) > TEN_ID
I would be very grateful for any thoughts or advise as this is a crucial area of my database design to get right.
Regards and many thanks - Mark
I am struggling to think how best to set up the relationships between the tables.
The basics are that ONE Landlord may have MANY properties and ONE Property may have many Tenants over time - but only one active Tenant at any time.
I have set the following ID's in each table.
Landlords - LAN_ID
Properties - PROP_ID
Tenants - TEN_ID
At first I thought the method below was the way to go:
LAN_ID > (one to many) > PROP_ID > (one to many) > TEN_ID
The problem with this approach is that I want to ensure that there is no risk of old tenants showing in forms and potentially the user applying data to the wrong tenant.
I then considered having a field in the Properties table called Ten_ID_Link, into which I could input the Ten_ID. I can make this field indexed so that a ten_ID would only appear once in the table and thus ensure that only one tenant is ever bound to a property. ie.
LAN_ID > (one to many) > PROP_ID
PROP_TENANT_ID_LINK > (one to one) > TEN_ID
I would be very grateful for any thoughts or advise as this is a crucial area of my database design to get right.
Regards and many thanks - Mark