nlp2sql / test.csv
zrx-kishore's picture
Rename athena Dataset - alpaca format - test.csv to test.csv
e89cb62
raw
history blame
32 kB
input,instruct,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;"