bbqwings
bbqwings

Reputation: 85

how can i design MSSQL database structure?

my scenario is one property (idproperty) has one meter (meterInfo_id), or several properties share one meter, should i consider it many-to-many or one-to-many relationship? if it is many-to-many relationship, how do i design? Thanks for helping.

enter image description here

Upvotes: 1

Views: 30

Answers (4)

Vivek Mishra
Vivek Mishra

Reputation: 1804

One Property has one meter OR many properties can share one meter BUT one property can not have many meters So it is not many to many relationship. Now many properties can share one meter then you must have meter_id column in your property table. Hence It is One to Many Relationship from meter to property table.

Upvotes: 0

Neeraj Sharma
Neeraj Sharma

Reputation: 588

This is one to many relations from MeterInfo to Property table. Create new column in property table as foreign key of meterinfo_id.

Upvotes: 0

Dhaval
Dhaval

Reputation: 2379

As per my Understanding Meter has One property or Multiple Properties so relation Between this two Entity would be One to Many.. So you Should add Meter Id to Property Table

Upvotes: 0

juergen d
juergen d

Reputation: 204904

Just add a meterInfo_id column to your property table. It is a 1-to-m relation.

Upvotes: 1

Related Questions