?
Solved

Do I have the correct database relations?

Posted on 2010-01-12
9
Medium Priority
?
165 Views
Last Modified: 2012-05-08
Hi,

I have the attached database diagram and relations for the backend of my tradesman web site. The concept is that a potential trader will navigate to my web site and insert their name, address etc along with their trade and trade type into my database through a frontend GUI, i.e. Joe Bloggs, 1 Microsoft Way etc, Builder, Houses. Do I have the right relations set up for this to work correctly? Should the relationship between my tblTrade table and tblTradeType table be a one to one relationship instead of a one to many as I do only want each trade for a specific trader to have one trade type? -  Another aspect I must mention is that ultimately I am going to build another similar frontend that will insert data into the same database (within different tables obviously) but this frontend will be for customers and not traders. The customer will insert themselves against a trade and trade type (the work they require) chosen from two drop down boxes on my frontend that are populated from the tblTrade and tblTradeType tables respectively.

Any help appreciated.
tables.JPG
0
Comment
Question by:MartinPetex
[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
  • 4
  • 4
9 Comments
 
LVL 14

Expert Comment

by:VBClassicGuy
ID: 26293109
Can't tell. Looks like the tblTrader table has the trader_title pointed to. Should be trader_id (can't mix nvarchars and int's).
0
 

Author Comment

by:MartinPetex
ID: 26293166
VBClassicGuy,

Sorry if my diagram isn't clear but I am using the trader_id column as my llink between tblTrader and tblTrade. The relationship link labels show the joining column.

Thanks.
0
 
LVL 19

Expert Comment

by:Rimvis
ID: 26293894
If "trade type" is an attribute of "trade", you should have FK trade_type_id in tblTrade:

tblTrade
   trade_id
   trader_id
   trade_type_id
   trade_name

tblTradeTypes
   trade_type_id  
   trade_type_name

Also, how ar you going to handle situation, when different traders have same trade? Maybe you should have separate table for list of possible trades, and a table, that links traders to trades, e.g.

tblTraderTrades
   trader_id
   trade_id

0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:MartinPetex
ID: 26294190
Rimvis,

Making my diagram look like the attached....?

Doesn't this make tblTrade.trader_id obsolete?

Thanks.
tables2.JPG
0
 

Author Comment

by:MartinPetex
ID: 26294212
....also am I right to make tblTraderTrades.trader_id and tblTraderTrades.trade_id both primary keys with no identity specification?

Thanks.
0
 
LVL 19

Expert Comment

by:Rimvis
ID: 26294223
>>Doesn't this make tblTrade.trader_id obsolete?
Yes it does.

Also, you should remove trade_id from tblTradeType
0
 
LVL 19

Expert Comment

by:Rimvis
ID: 26294234
>>  am I right to make tblTraderTrades.trader_id and tblTraderTrades.trade_id both primary keys with no identity specification

Yes
0
 

Author Comment

by:MartinPetex
ID: 26294332
Rimvis,

Resulting in the attached....?

If so, I will test this out and then reward points if I have no issues....thanks.
tables2.JPG
0
 
LVL 19

Accepted Solution

by:
Rimvis earned 2000 total points
ID: 26294398
>>Resulting in the attached....?
Yep
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

770 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