← SQL workplace practice

Procurement tradeoffs and award evidence · Original fictional data · Free files and full answers

Keep procurement alternatives on the cost and delivery Pareto frontier

For A quantity6 first require MOQ<=6<=capacity. Total cost=6*unit+shipping. A bid is dominated if another feasible bid costs no more and takes no longer, with at least one strict improvement. Return bid_id,supplier,total_cents,lead_days for all nondominated alternatives, sorted bid_id. Do not impose a deadline or collapse to one cheapest winner.

Use this fixed business case to build a checked CSV and a replayable SQL handoff. No account required. Scenario datasets are shared across related exercises; each exercise has its own decision and output contract.

Your output contract

  1. For A quantity6 first require MOQ<=6<=capacity. Total cost=6*unit+shipping. A bid is dominated if another feasible bid costs no more and takes no longer, with at least one strict improvement. Return bid_id,supplier,total_cents,lead_days for all nondominated alternatives, sorted bid_id. Do not impose a deadline or collapse to one cheapest winner.
  2. Return exactly the declared columns and order. Money uses integer cents; time and date units follow the task and field dictionary. NULL is unknown and differs from numeric zero.
  3. These are original fictional records and exercise policies. Scenario data may be shared with related tasks, whose decisions and output contracts differ.

Return columns exactly as bid_id, supplier, total_cents, lead_days. Sort order follows the task. Output has 2 rows; an empty CSV field means NULL.

Source data

bids

9 source rows · Download bids CSV

id INTEGERsupplier TEXTsku TEXTunit_cents INTEGERshipping INTEGERcapacity INTEGERmoq INTEGERlead_days INTEGERexpires INTEGERrisk_low INTEGERrisk_high INTEGER
1AlphaA1002001223200100
2BetaA9035084525100400
3GammaA110020121000
4AlphaB2002001024200100
5BetaB18035062625100400
6GammaB230012121000
7DeltaA8050055730300900
8DeltaB17050084730300900
9EpsilonA50250101825100300

kit

2 source rows · Download kit CSV

sku TEXTunits INTEGER
A6
B3

amendments

3 source rows · Download amendments CSV

line TEXTold_units INTEGERnew_units INTEGERunit_cents INTEGER
L158100
L240200
L303150
Field dictionary and schema
bids:
  id INTEGER — Stable source record identifier; not a row position.
  supplier TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  sku TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  unit_cents INTEGER — Exact integer monetary cents; no implicit currency conversion.
  shipping INTEGER — Fixed supplier order freight in cents.
  capacity INTEGER — Maximum quantity this bid can supply.
  moq INTEGER — Minimum nonzero order quantity.
  lead_days INTEGER — Elapsed delivery lead time in days.
  expires INTEGER — Expiry boundary; the goal declares whether equality is eligible.
  risk_low INTEGER — Lower supplier-level risk allowance in cents.
  risk_high INTEGER — Upper supplier-level risk allowance in cents.

kit:
  sku TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  units INTEGER — Physical unit quantity, not a monetary amount.

amendments:
  line TEXT — Literal business key or category label. Match exactly and retain NULL where present.
  old_units INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task.
  new_units INTEGER — Exact integer business measurement. Its specific business rule and eligibility are declared in the task.
  unit_cents INTEGER — Exact integer monetary cents; no implicit currency conversion.

Download complete SQLite setup

A method you can reuse

  1. For A quantity6 first require MOQ<=6<=capacity. Total cost=6*unit+shipping. A bid is dominated if another feasible bid costs no more and takes no longer, with at least one strict improvement. Return bid_id,supplier,total_cents,lead_days for all nondominated alternatives, sorted bid_id. Do not impose a deadline or collapse to one cheapest winner.
  2. For the first output record, bid_id = 3; supplier = Gamma; total_cents = 660; lead_days = 2.
  3. Inspect the source grain, keys and ties. Compare each result column with the full worked SQL and expected CSV.

Watch for this wrong turn

Sorting by price chooses slow Epsilon alone; sorting by speed chooses Gamma alone. The Pareto contract preserves both defensible tradeoff options.

Run and check in SQLite

Your SQL runs locally in the existing SQLite worker. The checker compares every column, row, type, value and row order with this fixed output. It accepts equivalent SELECT or WITH queries. Browser storage keeps your SQL on this device when available.

Complete worked SQL and expected output
WITH x AS (SELECT *,6*unit_cents+shipping total FROM bids WHERE sku='A' AND moq<=6 AND capacity>=6) SELECT a.id bid_id,a.supplier,a.total total_cents,a.lead_days FROM x a WHERE NOT EXISTS(SELECT 1 FROM x b WHERE b.total<=a.total AND b.lead_days<=a.lead_days AND (b.total<a.total OR b.lead_days<a.lead_days)) ORDER BY a.id;
"bid_id","supplier","total_cents","lead_days"
"3","Gamma","660","2"
"9","Epsilon","550","8"
Reference SQL · Complete expected CSV · Empty answer CSV

Choose another SQL task · Original data exception cases · Larger workplace projects