logo

Back to questions

Who Made Quota? [Oracle SQL Interview Question]

Easy

As a data analyst on the Oracle Sales Operations team, you are given a list of salespeople’s deals, and the annual quota they need to hit.

Write a query that outputs each employee id and whether they hit the quota or not ('yes' or 'no'). Order the results by employee id in ascending order.

Definitions:

  • : Deals acquired by a salesperson in the year. Each salesperson may have more than 1 deal.
  • : Total annual quota for each salesperson.

Table:

Column NameType
employee_idinteger
deal_sizeinteger

Example Input:

employee_iddeal_size
101400000
101300000
201500000
301500000

Table:

Column NameType
employee_idinteger
quotainteger

Example Input:

employee_idquota
101500000
201400000
301600000

Example Output:

employee_idmade_quota
101yes
201yes
301no

Explanation:

User 101 had $700k in sales, beating their $500k quota. User 201 had $500k in sales, beating their $400k quota. User 301 had $500k in sales, but had a $600k quota, so they didn't hit their goal.

The dataset you are querying against may have different input & output - this is just an example!

PostgreSQL 14