Professional Documents
Culture Documents
--2) How many number of doctors are assigned per territory in salesforce
SALESFORCE_STR
--4) Out of total calls made for Product E, what is the percentage of calls made at
position P1.
-- 5) Out of total doctors called for product_W in all sales forces, what is the
percentage of doctors being called on for PRODUCT_W by reps in salesforce
SALESFORCE_SP
where t2.PRODUCT_W_QUINTILE = 3
select (80241)
--9) What are the total PDEs(000s) for specialty group 1PAIN_MEDICINE for PRODUCT_M
Select (count(P1) * CALLS) as SP1, calls into t100 from calls_assignment as t20 INNER
JOIN spec_specgroup_mapping as t23
ON T20.DOC_ID = T23.DOC_ID
where t20.P1= 'PRODUCT_M' and t23.SPEC_GROUP = '1PAIN_MEDICINE'
Group by calls
Select (count(P2) * .5 * calls) as SP2 into t101 from calls_assignment as t20 INNER JOIN
spec_specgroup_mapping as t23
ON T20.DOC_ID = T23.DOC_ID
where t20.P2= 'PRODUCT_M' and t23.SPEC_GROUP = '1PAIN_MEDICINE'
group by calls
select SUM (SP2) from T101
select SUM (SP1) from T100
select 51058.5+102117
--10) What are the total PDEs (000) and calls (000) for PRODUCT_W in quintile Q5?
Select (count(P2) * .5 * calls) as SP2 INTO T101 from calls_assignment as t20 INNER JOIN
PRODUCT_QUINTILE as t23
ON T20.DOC_ID = T23.DOC_ID
where t20.P2= 'PRODUCT_W' and PRODUCT_W_QUINTILE = 5
group by calls
select SUM (SP2) from T101
select SUM (SP1) from T100
-- 13) Calculate the PDE ratio of all the products in order PRODUCT_M, PRODUCT_W,
PRODUCT_S, PRODUCT_E for territory AXBCAECS1
select (count(P1) * calls) as sp1 into t200 from calls_assignment
where p1= 'PRODUCT_M' and territory_id = 'AXBCAECS1'
group by calls
SELECT
(SELECT(select (select sum(sp1) from t200 )
+ (select sum(sp2) from t201)) )
/
-- 16) Calculate the unique and common doctors called for product W and product S.
Represent this scenario through a venn diagram.
-- 18) Which area has got the maximum doctors who are being called on for product W in
quintile 5?
-- 14) Alter table call assignment to add another column called Spec_group
-- 15) Update spec-group column with appropriate speciality group types using spec to
spec group mapping table.
-- 19) Alter table call assignment to add column PDEs_product_M. Update PDE_product_M
with the PDEs values for product M.
update Calls_ASSIGNMENT
set PDEs_PRODUCT_M = t401.SP2
from Calls_ASSIGNMENT as t1 inner join t401
on t1.DOC_ID = t401.DOC_ID
where t1.p2= 'PRODUCT_M'
-- 17) Generate a summary of unique doctors by areas and specialty group which are being
called upon for product S.
-- 20) Generate a summary of total calls by different selling teams and products.
Illustration shown below