Click here to Skip to main content
15,887,214 members
Home / Discussions / Database
   

Database

 
Questionconstraints Pin
Member 1041899722-Nov-13 0:47
Member 1041899722-Nov-13 0:47 
AnswerRe: constraints Pin
Chris Quinn22-Nov-13 2:13
Chris Quinn22-Nov-13 2:13 
AnswerRe: constraints Pin
thatraja22-Nov-13 2:51
professionalthatraja22-Nov-13 2:51 
Generaltriggers Pin
Member 1041899722-Nov-13 0:05
Member 1041899722-Nov-13 0:05 
QuestionRe: triggers Pin
thatraja22-Nov-13 0:08
professionalthatraja22-Nov-13 0:08 
QuestionHow to create linked server MySQL? Pin
Arun Sylvester J21-Nov-13 20:45
Arun Sylvester J21-Nov-13 20:45 
AnswerRe: How to create linked server MySQL? Pin
jschell22-Nov-13 9:50
jschell22-Nov-13 9:50 
QuestionSemicolon delimited lists in SQL Pin
.dan.g.21-Nov-13 13:12
professional.dan.g.21-Nov-13 13:12 
I was taught to model one-to-many relations using an intermediate 'link' table to maintain 1NF.

However I'm increasingly seeing one-to-many relationships modelled simply by concatenating the 'many' into a single string and storing that directly in the table.

Consider a table of TASKS, and a table of CATEGORYs, where each task may have multiple categories.

I was taught to model the relationships between the tasks and categories using a third table, eg TASK_CATEGORIES, which comprised a one-to-one mapping.
TASK Table
----------
Task_ID        Name            Allocated_To        etc
1              Fix XYZ Bug     Dan                 ...
2              Add ABC Feature Dan                 ...

CATEGORY Table
--------------
Cat_ID         Name            Description         etc
1              Bug             This is a bug       ...
2              Feature         This is a feature   ...
3              Work            This is a work item ...

TASK_CATEGORY Table
-------------------
Task_Cat_ID    Task_ID         Cat_ID
1              1               1
2              1               3
3              2               2
4              2               3

ie. The task: (Task_ID == 1) has categories: (Bug, Work), etc

However now I'm seeing:
TASK Table
----------
Task_ID        Name            Categories          Allocated_To        etc
1              Fix XYZ Bug     1;3                 ...
2              Add ABC Feature 2;3                 ...

CATEGORY Table (as before)

Clearly (IMO) the first design is more correct, but the second is often easier to work with.

The question for you is: What are the downsides of design #2, and have you seen it in practice?
.dan.g.

AbstractSpoon Software
email: abstractspoon2(at)optusnet(dot)com(dot)au

AnswerRe: Semicolon delimited lists in SQL Pin
Mycroft Holmes21-Nov-13 13:38
professionalMycroft Holmes21-Nov-13 13:38 
AnswerRe: Semicolon delimited lists in SQL Pin
PIEBALDconsult21-Nov-13 13:48
mvePIEBALDconsult21-Nov-13 13:48 
AnswerRe: Semicolon delimited lists in SQL Pin
Peter Leow21-Nov-13 13:58
professionalPeter Leow21-Nov-13 13:58 
GeneralRe: Semicolon delimited lists in SQL Pin
.dan.g.21-Nov-13 14:13
professional.dan.g.21-Nov-13 14:13 
Questionfind total money of parent node of tree according to a particular pattern Pin
jitendra raj20-Nov-13 5:54
jitendra raj20-Nov-13 5:54 
AnswerRe: find total money of parent node of tree according to a particular pattern Pin
Mycroft Holmes20-Nov-13 19:25
professionalMycroft Holmes20-Nov-13 19:25 
GeneralRe: find total money of parent node of tree according to a particular pattern Pin
jitendra raj20-Nov-13 22:46
jitendra raj20-Nov-13 22:46 
GeneralRe: find total money of parent node of tree according to a particular pattern Pin
Mycroft Holmes21-Nov-13 1:35
professionalMycroft Holmes21-Nov-13 1:35 
AnswerRe: find total money of parent node of tree according to a particular pattern Pin
Jörgen Andersson21-Nov-13 1:37
professionalJörgen Andersson21-Nov-13 1:37 
GeneralRe: find total money of parent node of tree according to a particular pattern Pin
jschell21-Nov-13 8:30
jschell21-Nov-13 8:30 
QuestionDynamic Filter Stored Procedure Pin
Commish1319-Nov-13 6:38
professionalCommish1319-Nov-13 6:38 
AnswerRe: Dynamic Filter Stored Procedure Pin
Mycroft Holmes19-Nov-13 12:02
professionalMycroft Holmes19-Nov-13 12:02 
Questionhow to write MAX query Pin
spanner2118-Nov-13 20:15
spanner2118-Nov-13 20:15 
AnswerRe: how to write MAX query Pin
Wayne Gaylard18-Nov-13 20:39
professionalWayne Gaylard18-Nov-13 20:39 
GeneralRe: how to write MAX query Pin
spanner2118-Nov-13 21:11
spanner2118-Nov-13 21:11 
GeneralRe: how to write MAX query Pin
Wayne Gaylard18-Nov-13 21:17
professionalWayne Gaylard18-Nov-13 21:17 
AnswerRe: how to write MAX query Pin
Mycroft Holmes18-Nov-13 21:11
professionalMycroft Holmes18-Nov-13 21:11 

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

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