You should have table called tbl_work (ID_EMP1 #, ID_EMP2 #) that's if you need to restrict 2 employees work together more than 4 times. Actually I don't understand you well but I'll give solution to what I got.
If you need system tracks whom\when employees work together and remove redundancy you can use this table tbl_work(ID_EMP1 #, ID_EMP2 #, WorkDate #).
Let's discuss that to understand you well
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
I really don't care about the dates they worked together, I just want to know how many times they worked together. So I really don't need the Date column and I could run the same query.
You really really really need it, tell me why because if you don't attach it and make the three columns primary key you enforced just 2 employees can work 2 or 4 times with each other? how come and watch out
Emp1# Emp2# Date
1 2 1/1/08 (√)
1 2 1/8/08 (X)
2 1 1/5/08 (√)
2 1 1/5/08 (X)
But if you do it like that Emp1#, Emp2# and Date#
Emp1# Emp2# Date#
1 2 1/1/08 (√)
1 2 1/8/08 (√)
2 1 1/5/08 (√)
2 3 1/5/08 (√)DATABASE DESIGN PRINCIPLE DON'T STORE ANY CALCULATED VALUE, Use SP to calculate it, faster, more performance, etc....
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
So, what do you think about my design?
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276
I am very thankful to your words, really you prove for me, there still long way I should cut to become really skilled DBA\BI\Software Engineer.
Your words is more valuable than any reply I got in my entire life really I don't overdo, it really is.
And it doesn't mean I've 1000+ posts and you've 50+; I am better than you. Absolutely NOT
I'll open a thread asking how to be skilled DBA, and I am deeply in need for your help.
Thanks, pclfw
Ramy Mahrous
Postaholic
2,196 posts since Aug 2006
Reputation Points: 480
Solved Threads: 276