Back to questions
Imagine you are a Data Analyst working at CVS Pharmacy, and you had access to pharmacy sales data. Use the SQL command to find data on medicines:
Output the manufacturer name, drug name, and the # of units sold. for all the medicines which match that criteria.
Hint: don't forget about the operator either!
Column Name | Type |
---|---|
product_id | integer |
units_sold | integer |
total_sales | decimal |
cogs | decimal |
manufacturer | varchar |
drug | varchar |
product_id | units_sold | total_sales | cogs | manufacturer | drug |
---|---|---|---|---|---|
9 | 37410 | 293452.54 | 208876.01 | Eli Lilly | Zyprexa |
34 | 94698 | 600997.19 | 521182.16 | AstraZeneca | Surmontil |
61 | 77023 | 500101.61 | 419174.97 | Biogen | Varicose Relief |
136 | 144814 | 1084258 | 1006447.73 | Biogen | Burkhart |
... | ... | ... | ... | ... | .... |
manufacturer | drug | units_sold |
---|---|---|
Roche | Topcare Tussin | 51707 |
AstraZeneca | Armour Thyroid | 47310 |
Let's break the problem into smaller pieces, and tackle each filtering condition one-by-one!
**Medicines manufactured by either Roche, Bayer, or AstraZeneca: **
Medicines that sold between 55,000 and 550,000 units:
Medicines that DID NOT sell between 55,000 and 550,000 units:
Putting this together with the clause gets us this final solution: