I'm putting together an insurance database. There are two tables within this db that i'm specifically concerned with right now. One is tblCustomers and the other is tblCoverages.
Data in tblCustomer tables are names - Joe, Fred, Bill Bob.
Data in tblCoverages are things like- Auto, Homeowners, Flood.... etc.
One customer can be associated with many coverages, and one coverage can be associated with many customers - therefore I need a junction table - right? so now I've set up this junction table and the data looks like this:
Customer Coverage
-------- ---------
Joe Auto
Fred Auto
Fred Flood
Bill Homeowners
Bill Flood
Bob Auto
Bob Homeowners
Sally Flood
It's easy to to something like:
Select Customers with Auto - that would return Joe, Fred, and Bob.
But what if I wanted to do something like:
Select Customer with ONLY Auto - which would theoretically only return Joe,
OR
something like:
Select Customers who have both Flood and Homeowners Policies - which would return Bill but skip Sally.
I don't think I can do this can I? I think I messed something up - the only other way I can think of doing it is having a yes/no column for each coverage with a table and then querying on the value of these fields.
But that seems like a bad way to do it, since ultimately, this database will have 15 or 20 different coverages of insurance - it seems like it should have it's own table.
Anyone offer any assistance?
thanks!
Q: Why is my computer doing that?
A: Random Perversity of Inanimate
Objects
Data in tblCustomer tables are names - Joe, Fred, Bill Bob.
Data in tblCoverages are things like- Auto, Homeowners, Flood.... etc.
One customer can be associated with many coverages, and one coverage can be associated with many customers - therefore I need a junction table - right? so now I've set up this junction table and the data looks like this:
Customer Coverage
-------- ---------
Joe Auto
Fred Auto
Fred Flood
Bill Homeowners
Bill Flood
Bob Auto
Bob Homeowners
Sally Flood
It's easy to to something like:
Select Customers with Auto - that would return Joe, Fred, and Bob.
But what if I wanted to do something like:
Select Customer with ONLY Auto - which would theoretically only return Joe,
OR
something like:
Select Customers who have both Flood and Homeowners Policies - which would return Bill but skip Sally.
I don't think I can do this can I? I think I messed something up - the only other way I can think of doing it is having a yes/no column for each coverage with a table and then querying on the value of these fields.
But that seems like a bad way to do it, since ultimately, this database will have 15 or 20 different coverages of insurance - it seems like it should have it's own table.
Anyone offer any assistance?
thanks!
Q: Why is my computer doing that?
A: Random Perversity of Inanimate
Objects