日期:2014-05-18  浏览次数:20787 次

晒下微软面试题^_^(Database)
Design database. Each employee has only one manager to report salary to. Each manager could has multiple employees reporting salary。For example D1 has 4 employees reporting to him/her,L1, L2, L3 and E4. L1 has 3 employees reporting to him/her, E1,E2,E3. L2 has 2 employees reporting to him/her, E5 and E6. L3 has only one employees reporting to him/her, E7. Calculate the total salary reporting to D1.

------解决方案--------------------
一个employee表,一个reportemployee表,一个report
employee里面用树型,reportemployee里面建一个是否提交report的字段.
每一个employee做Report的时候判断他的直接下属employee的report是否提交.
如果提交的话把这个report的数据都提取出来,再加上他的下属employee数据生成新的report数据.