File size: 32,009 Bytes
a7ed018
02fb50b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
input,instruction,output
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",How many claims did Kyprolis file in the last three months?,"

SELECT COUNT(distinct(claim_ID)) AS num_claims
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '90' day);"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",Which brand had the least claims in MM indication in last 3 months?,"

SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '90' day)
GROUP BY Drug_Name
ORDER BY num_prescriptions ASC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",Give me the market share by drug for the bottom 5 drugs for MM indication over the last 9 months,"

WITH
top_5_drugs AS (
SELECT Drug_Name, count (distinct(claim_id)) as prescription_count
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Drug_Name
order by prescription_count asc
limit 5
),
total_prescriptions AS (
SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
)
SELECT 
top_5_drugs.Drug_Name, 
ROUND(100.0 * top_5_drugs.prescription_count / total_prescriptions.total_prescriptions, 2) as market_share 
FROM top_5_drugs, total_prescriptions;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",Which brand had the highest claims in MM indication in last 9 months?,"

SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Drug_Name
ORDER BY num_prescriptions DESC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What was the market share for Kyprolis for years 2021 and 2018 for MM indication?,"

WITH
kyprolis_2021 AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND indication like '%MM%'
AND Prescription_Fill_Year_Month >= date('2021-01-01')
AND Prescription_Fill_Year_Month <= date('2021-12-31')
),
kyprolis_2018 AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND indication like '%MM%'
AND Prescription_Fill_Year_Month >= date('2018-01-01')
AND Prescription_Fill_Year_Month <= date('2018-12-31')
),
total_2021 AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date('2021-01-01')
AND Prescription_Fill_Year_Month <= date('2021-12-31')
),
total_2018 AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND Prescription_Fill_Year_Month >= date('2018-01-01')
AND Prescription_Fill_Year_Month <= date('2018-12-31')
)
SELECT 
ROUND(100.0 * kyprolis_2021.num_prescriptions / total_2021.num_prescriptions, 2) AS kyprolis_2021_market_share,
ROUND(100.0 * kyprolis_2018.num_prescriptions / total_2018.num_prescriptions, 2) AS kyprolis_2018_market_share
FROM kyprolis_2021, kyprolis_2018, total_2021, total_2018;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes","Over the past 9 months, which state in the US has seen a higher number of claims for Kyprolis in the MM indication compared to its competitors?","

WITH kyprolis_claims AS (
SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_claims
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Patient_State
),
competitor_claims AS (
SELECT Patient_State, COUNT(distinct(claim_ID)) AS num_claims
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name not like '%KYPROLIS%'
AND indication like '%MM%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Patient_State
)
SELECT kyprolis_claims.Patient_State
FROM kyprolis_claims, competitor_claims
WHERE kyprolis_claims.num_claims > competitor_claims.num_claims;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What is the relative growth of Kyprolis in last 5 months compared to previous year?,"

WITH
numerator AS (
select count(Distinct(claim_ID)) as total_claims from ""symphony-data"".""test_performance_v3"" where Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '5' month) and Drug_Name like '%KYPROLIS%'
),
denominator AS(
select count(distinct(claim_ID)) as total_claims from ""symphony-data"".""test_performance_v3"" where Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '1' year - interval '5' month) and Prescription_Fill_Year_Month <= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '1' year) and Drug_Name like '%KYPROLIS%'
)
SELECT (cast(numerator.total_claims as double) / (denominator.total_claims)-1)*100 as relative_growth from numerator, denominator;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What is the market share of Kyprolis in MM indication for patients above 40 years?,"

WITH num AS (
SELECT COUNT(DISTINCT(Claim_ID)) AS num_data 
FROM ""symphony-data"".""test_performance_v3"" 
WHERE Drug_Name LIKE '%KYPROLIS%' 
AND indication LIKE '%MM%' 
AND patient_age > 40 
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month) 
from ""symphony-data"".""test_performance_v3"") - interval '90' day)
),
den AS (
SELECT COUNT(DISTINCT(Claim_ID)) AS den_data 
FROM ""symphony-data"".""test_performance_v3"" 
WHERE indication LIKE '%MM%' 
AND patient_age > 40 
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month) 
from ""symphony-data"".""test_performance_v3"") - interval '90' day)
)
SELECT ROUND(100.0 * num_data / den_data, 2) AS market_share 
FROM num, den;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",Which drug had lowest claims for patients above 60 in MM indication over the last 1 year?,"

SELECT Drug_Name, COUNT(distinct(claim_ID)) as num_claims
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%MM%'
AND patient_age > 60
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '1' year)
GROUP BY Drug_Name
ORDER BY num_claims ASC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",In which state did Kyprolis have the highest number of prescriptions for the itp indication?,"

SELECT Patient_State, COUNT(distinct(Claim_ID)) as num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND indication like '%ITP%'
GROUP BY Patient_State
ORDER BY num_prescriptions DESC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes","Over the past 9 months, which state in the US had a lowest number of claims for Kyprolis in the cml indication compared to its competitors?","

WITH kyprolis_prescriptions AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND indication like '%CML%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Patient_State
),
competitor_prescriptions AS (
SELECT COUNT(distinct(claim_ID)) AS num_prescriptions, Patient_State
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name not like '%KYPROLIS%'
AND indication like '%CML%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
GROUP BY Patient_State
)
SELECT kyprolis_prescriptions.Patient_State, kyprolis_prescriptions.num_prescriptions/competitor_prescriptions.num_prescriptions as ratio
FROM kyprolis_prescriptions, competitor_prescriptions
WHERE kyprolis_prescriptions.Patient_State = competitor_prescriptions.Patient_State
ORDER BY ratio ASC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What is the most common payer type for Kyprolis in the past 9 months?,"

SELECT plan_type_description, COUNT(distinct(claim_ID)) as num_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '9' month)
AND plan_type_description NOT IN ('NONE', '')
GROUP BY plan_type_description
ORDER BY num_prescriptions DESC
LIMIT 1;"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What is the average out-of-pocket payment for Kyprolis in the state of New York (NY) in the past  month?,"

SELECT AVG(Total_Patient_Responsibility) as avg_patient_pay
FROM ""symphony-data"".""test_performance_v3""
WHERE Drug_Name like '%KYPROLIS%'
AND Patient_State = 'NY'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '1' month);"
"Hi! I need your help in generating an MySQL/ansi sql query.You are sql query generator all you should return is only query I am going to give you the schema associated with a database.
Name of the table is """"test_performance_v3"""".
Schema
Field Name | Field Type | Data Definition
NPI | varchar | 10 digit HCP identifier (Exclude blank and invalid NPIs from any queries)
Claim_ID | varchar | Unique claim identifier
Patient_ID | varchar | Unique patient identifier
Patient_Gender | varchar(8) | Patient Gender (Exclude """"Unknown"""" and blank values from any queries)
Patient_State | varchar | State in which prescription was filled (Exclude """"None"""" and blank values from any queries)
Region | varchar(9) | Region info of state
plan_type_description | varchar | Payor type (COMMERCIAL, MEDICARE, MEDICAID, etc.) in capital letters. (Exclude """"NONE"""" and blank values from any queries)
Plan_Name | varchar | Specific payor name
Drug_name | varchar | Brand or Drug name
Prescribed_Drug_Indication | varchar(2922) | Drug indication (based on prescribed drug)
Prescription_Fill_Year_Month | date | Date when prescription was filled
quantity | double | total quantity of drugs prescribed in each prescription
Total_Patient_Responsibility | double | Out of Pocket expense borne by patient
Total_Payer_Responsibility | double | Expense borne by payor
patient_age | integer | numeric age of patient in years
indication | string | Indications for given patient
Unknown_Flag | varchar(3) | If no disease detected, this would be Yes",What was the market share of the last 5 drugs prescribed for the cml indication over the past 6 months?,"

WITH
top_5_drugs AS (
SELECT Drug_Name, count (distinct(claim_id)) as prescription_count
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%CML%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '6' month)
GROUP BY Drug_Name
order by prescription_count desc
limit 5
),
total_prescriptions AS (
SELECT COUNT(distinct(claim_ID)) AS total_prescriptions
FROM ""symphony-data"".""test_performance_v3""
WHERE indication like '%CML%'
AND Prescription_Fill_Year_Month >= date((select max(Prescription_Fill_Year_Month)
from ""symphony-data"".""test_performance_v3"") - interval '6' month)
)
SELECT 
top_5_drugs.Drug_Name, 
ROUND(100.0 * top_5_drugs.prescription_count / total_prescriptions.total_prescriptions, 2) as market_share
FROM top_5_drugs, total_prescriptions;"