[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

What is the best schema ?

Posted on 2007-04-09
2
Medium Priority
?
228 Views
Last Modified: 2010-03-19
Hi Experts,

My tables look like this:
Users (UserId,...)
Companies (CompanyId,...)
Addresses (AddressId,...)

What is the best schema ?
Schema1:
Users_Addresses (UserAddressId, UserId, AddressId)
Companies_Addresses (CompanyAddressId, CompanyId, AddressId)
I can link UserAddressId or CompanyAddressId to another table.

Schema 2:
Group_Addresses (GroupId, UserId, CompanyId, AddressId) with CHECK constraint
CHECK(UserId IS NOT NULL AND CompanyId IS NULL  OR UserId IS NULL AND CompanyId IS NOT NULL)
I can link GroupId to another table.

Or any other schema ?

In any case,  I need to link the user address or the company address to another table.

Thanks in advance for your help.
0
Comment
Question by:noulouk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 50

Accepted Solution

by:
Lowfatspread earned 2000 total points
ID: 18876759
do users belong to companies?

have you just considered and addressuage table?

addressusage
usagetype, addressid, addressuser -- either a userid or a companyid

?
0
 
LVL 9

Author Comment

by:noulouk
ID: 18876915
Yes Users belong to Companies.

What do you mean by address usage ?
Is it something like this:
AddressUsage (AddressUsageId, UsageType, AddressId, UserOrCompanyId)
and I create relationships between UserId - UserOrCompanyId and CompanyId - UserOrCompanyId.

If so, I didn't know this was possible.
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
There are some very powerful Dynamic Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a di…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question