Solved

Help with table design?

Posted on 2009-07-10
2
210 Views
Last Modified: 2012-05-07
hi,

Can you take a look at my tables and see if I have correct PK & FK between tables.

MembersTable(userid,lname,fname,phone,office,createddate,createdby,modifieddate,modifiedby)
ProjectsTable(pid,pname,pstatus,startdate,enddate,customer,assigner,assignee,createddate,createdby,modifieddate,modifiedby)
TasksTable(tid,pid,taskname,parenttaskid,tdetail,tstatus,ttype,startdate,enddate,customer,assigner,assignee,createddate,createdby,modifieddate,modifiedby)
TaskTypesTable(ttid,taskType)
task might have a project. project will have at least one task.
userid will be used in assigner, assignee,createdby,modifiedby
Do I make assigner, assignee, createdby,and modifiedby as FK in ProjectsTable & TasksTable?

Thanks.
0
Comment
Question by:dkim18
2 Comments
 
LVL 31

Accepted Solution

by:
RiteshShah earned 300 total points
ID: 24828582
well, it is good to have FK for UserID so that even by mistake nothing could be entered in child table which is not exists in parent table.
0
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 200 total points
ID: 24830361
You'll want foreign keys for:

Members.UserID to Projects and Tasks (can't tell what fields...they should be named the same)
Tasks

Pretty much any type of lookup table you'll want to create a foreign key for integrity purposes.  You might also want to cosinder being a little more descriptive on your field names....for example, you could potentially create a FK from your members table to your modifiedby, createdby, customer, assigner fields, etc.  You know what I mean?
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
T-SQL to Update Table Dynamically 2 50
How to import SQL 2000 database to SQL 2014 5 115
How to simplify my SQL statement? 14 54
Find results from sql within a time span 11 33
This article will describe one method to parse a delimited string into a table of data.   Why would I do that you ask?  Let's say that you need to pass multiple parameters into a stored procedure to search for.  For our sake, we'll say that we wa…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

831 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