Hi,
I have a database design question that I was hoping a DB professional could answer. Lets say I have the following one-to-many table relationship between an Account and its Addresses.
An account can have many addresses but only one can be the primary. Does it make sense to include a soft link in the main table to hold the key of the address that is the primary? ie.
This is purely to return the primary address of account (with the best performance in mind).
Is this a bad design? Does the need to sync the account and acctaddress tables outweigh the performance advantages?
I would appreciate any thoughts on this.
Thanks
Ry
I have a database design question that I was hoping a DB professional could answer. Lets say I have the following one-to-many table relationship between an Account and its Addresses.
Code:
create table account (
acctkey int,
acctname varchar(100),
active bit
)
create table acctaddress (
acctkey int,
addkey int,
street1 varchar(100),
isprimary bit
)
An account can have many addresses but only one can be the primary. Does it make sense to include a soft link in the main table to hold the key of the address that is the primary? ie.
Code:
create table account (
acctkey int,
acctname varchar(100),
active bit,
primaryaddkey int <---
)
This is purely to return the primary address of account (with the best performance in mind).
Is this a bad design? Does the need to sync the account and acctaddress tables outweigh the performance advantages?
I would appreciate any thoughts on this.
Thanks
Ry