Click here to Skip to main content

Design and Architecture

 
GeneralRe: Current Best Practices PinmemberJonathanEdwards5-Sep-12 8:37 
GeneralRe: Current Best Practices Pinmemberdhofferber5-Sep-12 8:54 
AnswerRe: Current Best Practices PinmemberExpert Coming20-Sep-12 15:32 
QuestionNeed Suggestions For a Good Formal Requirements Tool PinmemberPatricia.Jones012324-Aug-12 6:07 
AnswerRe: Need Suggestions For a Good Formal Requirements Tool PinmemberEddy Vluggen26-Aug-12 0:39 
QuestionUI Guidelines PinmemberBrian C Hart22-Aug-12 12:04 
AnswerRe: UI Guidelines PinprotectorPete O'Hanlon22-Aug-12 12:29 
QuestionUtility Field in Database Pinmembereddieangel21-Aug-12 12:38 
I have three tables, ClaimEvent, Event, and EventScope. The actual ClaimEvent can be relevant to an entire claim, or a single property within a claim. Every property has a claimId.
 
As such, I have designed my tables like this:
 
Event
id | Int Identity AI
name | varchar
scopeId | int
 
EventScope
id | Int Identity AI
name | varchar
 
ClaimEvent
id | Int Identity AI
eventId | Int FK to Event
targetId | Int
date | DateTime
 
My idea is to use the targetId field in the ClaimEvent table to refer either to the Claim ID (if the event is relevant to the entire claim), or the Property ID (if the event is relevant only to the current property). If I want all events relevant to the selected claim, including properties within that claim, I can just match the targetId field with the id field in the property table when the scope is "property wide". Alternatively, I would have to design the table like this:
 
ClaimEvent
id | Int Identity AI
eventId | Int
claimId | Int
propertyId | Int?
date | DateTime
 
With the propertyId field frequently being null. However, I would be able to force FK constraints to the Claim and Property tables, which I can't do otherwise. The data is all going to be entered through a data entry form, with drop downs and very little possibility of FK violations, but it is always possible.
 
What do you guys think? I am always a fan of minimizing fields that will often be null, especially when I can repurpose another field, but it feels a little hackish.
 
Cheers, --EA
AnswerRe: Utility Field in Database PinmemberEddy Vluggen22-Aug-12 6:51 
AnswerRe: Utility Field in Database PinmemberNagy Vilmos22-Aug-12 7:07 
AnswerRe: Utility Field in Database PinmemberBobJanova22-Aug-12 7:28 
GeneralRe: Utility Field in Database Pinmembereddieangel22-Aug-12 8:36 
GeneralRe: Utility Field in Database Pinmemberjschell22-Aug-12 9:55 
GeneralRe: Utility Field in Database Pinmembereddieangel22-Aug-12 10:00 
GeneralRe: Utility Field in Database Pinmemberjschell22-Aug-12 14:24 
GeneralRe: Utility Field in Database Pinmembereddieangel22-Aug-12 14:26 
GeneralRe: Utility Field in Database Pinmemberjschell23-Aug-12 9:12 
GeneralRe: Utility Field in Database Pinmembereddieangel23-Aug-12 9:23 
GeneralRe: Utility Field in Database Pinmemberjschell23-Aug-12 9:57 
GeneralRe: Utility Field in Database Pinmembereddieangel23-Aug-12 10:01 
GeneralRe: Utility Field in Database Pinmemberjschell24-Aug-12 9:28 
GeneralRe: Utility Field in Database Pinmembereddieangel24-Aug-12 9:31 
QuestionStandard exceptions for an RPC library? Pinmemberjohndw9416-Aug-12 20:43 
AnswerRe: Standard exceptions for an RPC library? PinmemberEddy Vluggen16-Aug-12 23:30 
GeneralRe: Standard exceptions for an RPC library? Pinmemberjohndw9417-Aug-12 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 18 Nov 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid