Need a quick help from the DB experts:
I have two tables:
HOURS
SSN Start End ID
--- --- --- 3
--- --- --- 3
--- --- --- 5
--- --- --- 5
--- --- --- 5
--- --- --- 5
LOCATION
Addr Num
--- 1
--- 2
--- 3
--- 4
--- 5
On the first table, the value of SSN is redundant, so is the ID; therefore there's no particular Primary Key choice. However, a composite key can be used taking SSN and ID together, which makes the combined fields unique.
Now, the Num and ID are related (i.e., HOURS.ID = Location.Num).
The problem:
Listing the ones that are absent in ID, but are present in Num, which means the output should be :
1
2
4
or anything representing them, such as the list of 'addr's corresponding to 1,2 and 4.
I spent too much of time on this. Hope someone knows the way out.