Menu▾

The question bank

SQL Questions

101 questions themed around companies you'll actually interview at in the region. Solve them right here: real Postgres, in your browser.

Questions and solutions stay in English — bahasa temu duga sebenar, so you practise reading the exact language a real interview uses.

47 free · the rest included with Basic

Window functionsSQL basicsStatistics and A/B testingAggregationJoinsDates and timesSubqueries and CTEsText and pattern matchingMath and numbersIndexingSchema designGrabShopeeAirAsiaGXBankLazadaMaybankTraveloka

101 of 101

easyAdd a primary key to an unkeyed orders tableFree→easyApplicants with no referral code on fileFree→easyAverage balance by account typeBasic→easyCheapest flights to a destinationFree→easyClassify e-wallet balances into tiersFree→easyClassify insurance policies into tiersFree→easyClean up messy product namesFree→easyClean up messy size codesFree→easyClose the loophole on a column that's never actually nullFree→easyCompleted rides by cityFree→easyConversion rate per variantFree→easyDays remaining until subscription expiryFree→easyFind products from a specific brandFree→easyFind Toyota listings, regardless of caseFree→easyLabel moderation queue items by urgencyFree→easyLine totals after a percentage discountFree→easyMerchants on personal email domainsFree→easyOrders by statusFree→easyOrders with customer namesFree→easyProducts nobody has bought yetNewBasic→easyProfit margin per productFree→easyPull the branch code out of a reference numberFree→easyRank grocery items by price within each categoryFree→easySelected routes, mid-range priceFree→easyShipped or delivered orders worth over RM 100Free→easyShow 'Unassigned' for branches without a managerBasic→easyShow each customer's previous purchase amountFree→easyShow each transaction with its merchant nameFree→easyShow every top-up next to the overall averageFree→easyUsers assigned to both variantsBasic→easyWallets with a healthy balanceFree→mediumAbsolute difference and relative liftFree→mediumAccounts above their own branch's averageBasic→mediumAd click-through conversion rate, per campaignBasic→mediumAttach the policy rate in force on each dateBasic→mediumAverage ride duration, by monthBasic→mediumBranches beating the network's average growthBasic→mediumBucket clients into risk-score bandsBasic→mediumBuyers active in both January and FebruaryBasic→mediumCompute the median fare across all bookingsBasic→mediumCumulative conversion rate by dayBasic→mediumCustomers who never orderedBasic→mediumCustomers with no way to reach themBasic→mediumDefect rate per production lineBasic→mediumDrivers rated above averageBasic→mediumEmployees who out-earn their managerBasic→mediumEnforce uniqueness the way a UNIQUE constraint actually worksFree→mediumEvery customer who has banked online or in a branchBasic→mediumEvery part, with its supplier (if assigned)Basic→mediumExtract the failure reason from a DuitNow error messageFree→mediumFind accounts with zero transactionsFree→mediumFive-year premium projectionBasic→mediumFlag shipments that breached their SLAFree→mediumGuardrail metric regressionsBasic→mediumInactive subscribersBasic→mediumIndex a foreign key column Postgres never indexed for youFree→mediumLabel TNB bills as on-time, late, or unpaidFree→mediumLink orders to customers with an enforced, cascading foreign keyFree→mediumMonthly fuel salesBasic→mediumNovelty effect over four weeksFree→mediumNumber each subscriber's reloads in orderFree→mediumOutage duration in minutesFree→mediumPick the largest transactions for audit samplingFree→mediumPivot quarterly sales into columnsBasic→mediumPlayers who churned after JanuaryBasic→mediumRevenue per routeBasic→mediumRound prices up, round loyalty points downFree→mediumRunning balance for each e-walletFree→mediumSample ratio mismatchBasic→mediumSplit mudarabah profit across depositors by weighted balanceFree→mediumTop 3 restaurants by ordersBasic→mediumTotal fuel spend per monthBasic→mediumTotal spend per customerBasic→mediumUtilisation rate per consultantFree→hardBusiest data center in each regionBasic→hardCharge each payout its tier's feeBasic→hardCount overdue installments by ageing bucketBasic→hardDay-over-day change in order volumeBasic→hardDrivers delayed 3+ days in a rowBasic→hardFind duplicate fraud alerts on the same cardBasic→hardFind weekdays with no timesheet entryBasic→hardGet the column order right on a composite indexFree→hardMonth-over-month change in units soldBasic→hardPair every employee with their managerBasic→hardParse quantity and price out of receipt linesBasic→hardPivot payment channels into columns, per merchantBasic→hardPooled standard error and z-scoreBasic→hardPrevious month's revenueFree→hardRank customers by spendBasic→hardRank customers by transaction amount, per branchBasic→hardRank projects by margin within each practiceBasic→hardRequired sample sizeBasic→hardRevenue per user, before and after trimmingBasic→hardRunning total of daily salesFree→hardSecond most expensive product per categoryFree→hardShow each customer's previous tier alongside their new oneBasic→hardSignificance at 5%Basic→hardSimpson's paradox in an A/B testBasic→hardSplit customers into spending quartilesBasic→hardTotal paid, joined across three tablesBasic→hardTotal shipped, joined across three tablesBasic→