Back to questions

SQL IN Practice Exercise SQL Interview Question

SQL IN Practice Exercise

SQL Interview Question

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:

  • which were manufactured by either Roche, Bayer, or AstraZeneca
  • and did not sell between 55,000 and 550,000 units

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!

Table:

Column NameType
product_idinteger
units_soldinteger
total_salesdecimal
cogsdecimal
manufacturervarchar
drugvarchar

Sample Input:

product_idunits_soldtotal_salescogsmanufacturerdrug
937410293452.54208876.01Eli LillyZyprexa
3494698600997.19521182.16AstraZenecaSurmontil
6177023500101.61419174.97BiogenVaricose Relief
13614481410842581006447.73BiogenBurkhart
...................

Example Output:

manufacturerdrugunits_sold
RocheTopcare Tussin51707
AstraZenecaArmour Thyroid47310

Difficulty

Easy

Input

Output