Unix Technical Forum

Finding missing entries between two tables linked by a link table

This is a discussion on Finding missing entries between two tables linked by a link table within the MySQL forums, part of the Database Server Software category; --> Hi, I have three tables as follows - TestCase (Table Name) Id (Primary Key) Name Scenario (Table Name) Id ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:27 AM
aine_canby@yahoo.com
 
Posts: n/a
Default Finding missing entries between two tables linked by a link table

Hi,

I have three tables as follows -

TestCase (Table Name)
Id (Primary Key)
Name

Scenario (Table Name)
Id (Primary Key)
Name

TestCaseToScenario (Table Name)
TestCaseId
ScenarioId

Therefore each Scenario is associated with zero or one Test Cases.

What search could I use to find Test Cases with no Scenarios.

Thanks for your help,

Aine

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:27 AM
Captain Paralytic
 
Posts: n/a
Default Re: Finding missing entries between two tables linked by a link table

On 31 Aug, 09:14, aine_ca...@yahoo.com wrote:
> Hi,
>
> I have three tables as follows -
>
> TestCase (Table Name)
> Id (Primary Key)
> Name
>
> Scenario (Table Name)
> Id (Primary Key)
> Name
>
> TestCaseToScenario (Table Name)
> TestCaseId
> ScenarioId
>
> Therefore each Scenario is associated with zero or one Test Cases.
>
> What search could I use to find Test Cases with no Scenarios.
>
> Thanks for your help,
>
> Aine


I don't agree with the statement:
"Therefore each Scenario is associated with zero or one Test Cases."
The table structure that you have shown supports the statement:
"Therefore each Scenario is associated with zero, one or many Test
Cases."

If there can really be only 0 or one testcases for a scenario then the
structure:

Scenario (Table Name)
Id (Primary Key)
TestCaseId
Name

TestCase (Table Name)
Id (Primary Key)
Name

supports this much better.

In either case a LEFT JOIN with a test to see if the JOINed to id IS
NULL is the way to go.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:08 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com