PAU OJ Online Judge
ProblemsLearnStudy plansContestsSubmissionsRank

Updates

Announcements and upcoming contests

Loading announcements…
Sign in for personal alertsBrowse contests
Log inSign up

PAU OJ

PrimeAsia University Online Judge

A real online judge for programming practice, university contests and coding assessments. Write code in your browser, get sandboxed verdicts, and track your progress.

Platform

  • Problems
  • Contests
  • Submissions
  • Ranking
  • Reviewers

Resources

  • User guide
  • Changelog
  • How judging works
  • System health
  • Create an account

© 2026 PrimeAsia University Online Judge. All rights reserved.

v0.9.0

SQL Labs

ShopSphere: query the marketplace

একটি মাল্টি-ভেন্ডর অনলাইন দোকান। ভেন্ডর, কাস্টমার, প্রোডাক্ট, অর্ডার, পেমেন্ট, শিপমেন্ট, রিটার্ন, কুপন, কার্ট, ইনভেন্টরি, রিভিউ আর ভেন্ডর পেআউট — সব একই ডেটাবেসে। প্রতিটি টপিক বাস্তব প্রশ্ন দিয়ে শুরু হয়, তারপর সেই প্রশ্নের SQL সমাধান।

All learning tracks
Real judge problems Time & memory limits SQL · MySQL · PostgreSQL syntax

The ShopSphere database

প্রতিটি সমস্যা একই ডেটাসেটে চলে। নিচের টেবিলগুলো মনে রাখো — প্রশ্নের ভেতরেই বলে দেওয়া থাকবে কোনটা লাগবে। SQL/MySQL/PostgreSQL যেকোনো syntax-এ লিখতে পারো (portable standard SQL সবচেয়ে নিরাপদ)।

categories

id, name, parent_id

vendors

id, name, city, rating

customers

id, name, city, signup_date

products

id, vendor_id, category_id, name, price_cents, stock, rating

orders

id, customer_id, ordered_at, status

order_items

id, order_id, product_id, quantity, unit_price_cents

reviews

id, product_id, customer_id, rating, created_at

referrals

customer_id, referred_by

product_attributes

product_id, brand, color, warranty_months, attributes

product_variants

id, product_id, sku, size, color, price_cents, stock

payments

id, order_id, method, amount_cents, status, paid_at, transaction_ref

shipments

id, order_id, carrier, tracking_no, status, shipped_at, delivered_at

returns

id, order_item_id, quantity, reason, refund_cents, status, requested_at

coupons

id, code, kind, value, min_order_cents, starts_at, ends_at, max_uses

coupon_redemptions

id, coupon_id, order_id, customer_id, discount_cents, redeemed_at

carts

id, customer_id, status, created_at, updated_at

cart_items

id, cart_id, product_id, quantity, unit_price_cents, added_at

inventory_movements

id, product_id, kind, quantity, reference, created_at

vendor_payouts

id, vendor_id, period_start, period_end, gross_cents, commission_cents, refund_cents, net_cents, status, paid_at

Production database handbookDDL, constraints, indexes/EXPLAIN, transactions, views, security, partitioning and dialect differences — the project layer around the queries.Read handbook →ShopSphere industry projectA production brief behind both SQL tracks: squads, work tickets, the production schema, metrics and the final handover.19 tables ·7 feature squads ·23 work tickets ·190 seed rows

Track 08 · 40 h

Basic SQL · ShopSphere

ShopSphere মাল্টি-ভেন্ডর দোকানের ডেটা দিয়ে SQL শেখা শুরু। ভেন্ডর-প্রোডাক্ট খোঁজা, অর্ডার ও আইটেম জোড়া লাগিয়ে রেভিনিউ, dead stock, subquery, self-join, set operations, টেক্সট/তারিখ সার্চ, পেমেন্ট-শিপমেন্ট-রিটার্ন আর pagination—প্রতিটি টপিক বাস্তব প্রশ্ন দিয়ে শুরু, তারপর সেই প্রশ্নের query।

FreeOpen track

দোকান চেনা

Meet the marketplace

2 guided · 4 practice

ভেন্ডর, প্রোডাক্ট আর স্টকের টেবিল চিনে SELECT/WHERE/ORDER BY দিয়ে প্রথম রিপোর্ট।

  • Vendor directoryEasy100 pts3s256 MB

Track 09 · 56 h

Advanced SQL · ShopSphere

এবার ShopSphere-এর অ্যানালিটিক্স টিমে কাজ। Window function দিয়ে র‍্যাংকিং, চলমান রেভিনিউ ও moving average; recursive CTE দিয়ে ক্যাটাগরি ও রেফারেল; CTE দিয়ে ফানেল, কুপন attribution, JSON/ইনভেন্টরি reconciliation, ভেন্ডর payout ও retention; সাথে EXPLAIN-ভিত্তিক performance টিউনিং আর script-মোডের DDL/DML ল্যাব—সব বাস্তব project প্রশ্ন ধরে ধরে।

৳500Unlock for ৳500

র‍্যাংক ও টাইমলাইন

Rankings & timelines

2 guided · 4 practice

RANK আর SUM() OVER দিয়ে প্রতি ক্যাটাগরির সেরা প্রোডাক্ট ও চলমান রেভিনিউ।

  • Top product per categoryHard
Low-stock shelfEasy100 pts3s256 MB

টাকার হিসাব

Money & orders

2 guided · 4 practice

JOIN, GROUP BY আর HAVING দিয়ে ভেন্ডরের রেভিনিউ ও প্রতিটি অর্ডারের মোট টাকা।

  • Vendor revenueMedium200 pts3s256 MB
  • Order receiptsMedium200 pts3s256 MB

যেখানে সারি নেই

Missing pieces

2 guided · 4 practice

LEFT JOIN, NOT EXISTS আর CASE দিয়ে dead stock, নিষ্ক্রিয় কাস্টমার আর স্টক bucket বের করা।

  • Dead stockMedium200 pts3s256 MB
  • Stock health bucketsEasy150 pts3s256 MB

প্রশ্নের ভিতরে প্রশ্ন

Questions inside questions

2 guided · 4 practice

Correlated subquery আর EXISTS দিয়ে ক্যাটাগরির গড়ের চেয়ে দামি প্রোডাক্ট ও অর্ডারহীন কাস্টমার।

  • Above category averageMedium200 pts3s256 MB
  • Customers with no ordersMedium200 pts3s256 MB

সেট ও ডেটা কোয়ালিটি

Sets & data quality

2 guided · 4 practice

UNION, EXCEPT আর NOT EXISTS দিয়ে শহরের কভারেজ তালিকা আর রিভিউ-না-লেখা ক্রেতা — ডেটা কোয়ালিটির প্রথম পাঠ।

  • Marketplace citiesEasy150 pts3s256 MB
  • Buyers without a reviewMedium200 pts3s256 MB

টেক্সট, তারিখ ও সার্চ

Search, text & dates

2 guided · 4 practice

LIKE wildcard, case-insensitive সার্চ আর ISO তারিখের রেঞ্জ ফিল্টার — সার্চ বার থেকে ত্রৈমাসিক রিপোর্ট।

  • Product keyword searchEasy150 pts3s256 MB
  • Q1 signupsEasy150 pts3s256 MB

অর্ডারের জীবনচক্র

Order lifecycle

2 guided · 4 practice

পেমেন্ট, শিপমেন্ট আর রিটার্নের চেইন — NOT EXISTS দিয়ে বকেয়া অর্ডার, CTE দিয়ে ভেন্ডর-ভিত্তিক রিটার্নের হার।

  • Orders without a paid paymentMedium200 pts3s256 MB
  • Return rate by vendorMedium200 pts3s256 MB

জয়েনের গভীরে

Joins in depth

2 guided · 4 practice

Self-join দিয়ে একই ক্যাটাগরির প্রোডাক্ট আর একই শহরের ভেন্ডরের অনন্য জোড়া — ডুপ্লিকেট-জোড়ার ফাঁদ, query execution order পর্যন্ত।

  • Same-category product pairsMedium200 pts3s256 MB
  • Vendor peers by cityEasy150 pts3s256 MB

পেজিনেশন ও টপ-এন

Pagination & top-N

2 guided · 4 practice

LIMIT/OFFSET দিয়ে রেভিনিউ তালিকার দ্বিতীয় পেজ, correlated subquery-তে MAX দিয়ে প্রতি কাস্টমারের সর্বশেষ অর্ডার।

  • Top products, page twoMedium175 pts3s256 MB
  • Latest order per customerMedium200 pts3s256 MB

টেক্সট, তারিখ ও সময়

Text, dates & time

2 guided · 4 practice

LIKE দিয়ে কেস-নিরপেক্ষ কাস্টমার সার্চ, julianday দিয়ে অর্ডারের বয়স — টাইমজোনের সতর্কতাসহ।

  • Customer search boxEasy150 pts3s256 MB
  • Order age in daysMedium175 pts3s256 MB

Basic SQL checkpoint· 45 min

ShopSphere-এর বেসিক রিপোর্ট তিনটি—টপ কাস্টমার, মাসিক রেভিনিউ আর রেটিং লিডারবোর্ড। ৪৫ মিনিটে তিনটি query লিখে প্রমাণ করো যে SELECT, JOIN, GROUP BY আর HAVING তোমার আয়ত্তে।

ShopSphere Analyst
  • Top customersMedium200 pts3s256 MB
  • Monthly revenueMedium200 pts3s256 MB
  • Rating leaderboardMedium200 pts3s256 MB
300 pts
3s
256 MB
  • Running revenueHard300 pts3s256 MB
  • সম্পর্কের গভীরে

    Trees & referrals

    2 guided · 4 practice

    Recursive CTE দিয়ে ক্যাটাগরি path আর রেফারেল চেইনের depth।

    • Category treeHard300 pts3s256 MB
    • Referral depthHard300 pts3s256 MB

    শেয়ার ও প্রবৃদ্ধি

    Shares & growth

    2 guided · 4 practice

    CTE আর window function দিয়ে ক্যাটাগরির রেভিনিউ শতাংশ ও মাসভিত্তিক growth।

    • Category revenue shareHard300 pts3s256 MB
    • Month-over-month growthHard300 pts3s256 MB

    টাইমলাইন ও চলমান মেট্রিক

    Timelines & moving metrics

    2 guided · 4 practice

    Window frame আর PARTITION BY দিয়ে দৈনিক রেভিনিউয়ের ৭-দিনের চলমান গড় এবং কাস্টমার-ভিত্তিক running total।

    • Daily revenue moving averageHard320 pts3s256 MB
    • Customer running totalHard320 pts3s256 MB

    ফানেল ও কুপন

    Funnels & coupons

    2 guided · 4 practice

    Conditional aggregation দিয়ে মাসিক কার্ট-কনভার্সন, আর CTE দিয়ে কুপনভিত্তিক রেভিনিউ—order_items-এর double-count এড়িয়ে।

    • Cart conversion funnelHard320 pts3s256 MB
    • Coupon performanceHard320 pts3s256 MB

    JSON ও ইনভেন্টরি

    JSON & inventory

    2 guided · 4 practice

    json_extract দিয়ে JSON attributes পড়ে ব্র্যান্ড-ওয়ারেন্টি রিপোর্ট, আর inventory_movements লেজার গুনে products.stock-এর অমিল ধরা।

    • Brand warranty reportHard350 pts3s256 MB
    • Stock reconciliationHard350 pts3s256 MB

    ফিন্যান্স ও পেআউট

    Finance & payouts

    2 guided · 4 practice

    CTE দিয়ে payout আবার হিসাব করে vendor_payouts যাচাই, আর ভেন্ডর ধরে রিফান্ডের হার ও net রেভিনিউ বের করা।

    • Payout reconciliationHard350 pts3s256 MB
    • Refund impactHard350 pts3s256 MB

    অ্যাডভান্সড উইন্ডো

    Advanced windows

    2 guided · 4 practice

    LAG/LEAD, NTILE, PERCENT_RANK, FIRST_VALUE/LAST_VALUE, named window আর ROWS/RANGE frame—কাস্টমারের অর্ডার-ফাঁক আর ক্যাটাগরির দাম-স্তর বের করা।

    • Customer order gapsHard350 pts3s256 MB
    • Category price quartilesHard350 pts3s256 MB

    পিভট ও গ্রুপিং

    Pivot & grouping

    2 guided · 4 practice

    SUM+CASE দিয়ে চওড়া রিপোর্ট (pivot), GROUPING SETS/ROLLUP/CUBE-এর ধারণা আর SQLite-এর UNION ALL বিকল্প—মাস কলামে, ভেন্ডর ও স্ট্যাটাস সারিতে।

    • Vendor monthly revenue pivotHard350 pts3s256 MB
    • Monthly order status matrixHard350 pts3s256 MB

    কোয়েরি পারফরম্যান্স

    Query performance

    2 guided · 4 practice

    EXPLAIN প্ল্যান পড়ে, sargable predicate, composite index আর keyset pagination দিয়ে ধীর query-কে দ্রুত query-তে বদলানো।

    • Keyset paginationHard350 pts3s256 MB
    • Sargable date rangesHard350 pts3s256 MB

    DDL ও ইনডেক্স

    DDL & indexes

    2 guided · 0 practice

    Sandbox-এ CREATE INDEX আর CREATE VIEW লিখে স্কিমা বদলানো, sqlite_master দিয়ে যাচাই করা, আর কখন index বা view ব্যবহার করবে তা বোঝা।

    • Index lab: orders lookupHard350 pts3s256 MB
    • View lab: vendor revenueHard350 pts3s256 MB

    DML ও ট্রানজেকশন

    DML & transactions

    2 guided · 0 practice

    INSERT/UPDATE/DELETE নিরাপদে চালানো, BEGIN/COMMIT/ROLLBACK দিয়ে সব-বা-কিছু নীতি, আর কোন কাজে transaction লাগে তা ঠিক করা।

    • DML lab: product lifecycleHard350 pts3s256 MB
    • Transaction lab: safe rollbackHard350 pts3s256 MB

    ক্যাপস্টোন

    Capstone: vendor & retention

    2 guided · 4 practice

    ভেন্ডর scorecard আর signup-cohort retention—একাধিক CTE, conditional aggregation ও rank একসাথে।

    • Vendor scorecardHard350 pts3s256 MB
    • Cohort retentionHard350 pts3s256 MB

    Advanced SQL checkpoint· 45 min

    ভেন্ডর-মাস রেভিনিউ, রিপিট বায়ার আর স্টক ভ্যালু—তিনটি অ্যাডভান্সড রিপোর্ট। ৪৫ মিনিটে GROUP BY, HAVING আর join-এর সমন্বয় দেখাও।

    ShopSphere Architect
    • Vendor monthly revenueHard300 pts3s256 MB
    • Repeat buyersMedium200 pts3s256 MB
    • Stock value by vendorMedium200 pts3s256 MB