InterviewLegend

SQL in the Assessment

Alex Chen16 min readUpdated 78 real interview reports

Most engineers prep the Morgan Stanley lateral assessment as an algorithm test and never open a SQL editor, which quietly leaves points on the table. The experienced-hire online assessment runs on HackerRank at roughly seventy to ninety minutes: two coding questions, a heavy multiple-choice block on Core Java and the systems around it, and a SQL query. That SQL query is graded like everything else, so a strong coder who skipped query practice can walk out having answered only part of the assessment well. This lesson closes that gap. The query shapes a bank reaches for are stable, and rehearsing them until they are automatic frees your attention for the harder half of the test.

Grade yourself the way the assessment does: a query that runs, returns the right rows, and reads cleanly on the first pass. The bar is Easy to Medium, never exotic. Nobody is asking you to tune a query planner or unwind a recursive CTE. You will be asked to join two tables, aggregate a column, filter groups with the right clause, and occasionally rank or accumulate with a window function. Every query below is written for SQLite, the engine HackerRank runs, and each one has been run against real rows so the answer is not a guess.

The Morgan Stanley angle
A SQL query is a first-class item on the Morgan Stanley lateral OA. The experienced-hire HackerRank blocks come phrased as "two coding questions and one SQL," or a wall of MCQs with a single SQL query attached. The domain wears the firm's vocabulary: trades, accounts, desks, and positions instead of the textbook orders-and-products. The SQL underneath is identical, so do not let the framing throw you. Read the shape hiding in the words. A phrase like "for each account" is a GROUP BY or a PARTITION BY. "Keep only the ones where the total exceeds" is a HAVING. "The position as the blotter runs down the day" is a window function ordered by trade date. Learn to hear the pattern and the domain stops mattering.
What's inside
  • 4 sections
  • about 16 min

Premium lessonMorgan Stanley interview guide

These took digging.

What candidates walked out with, from 20,000+ reports, forum threads behind logins and write-ups in Chinese. Then solved step by step.

100 companies. Checked every month.

Unlock all 100 companies

$49 a year · less than $1 a week · Cancel anytime

Had your Morgan Stanley interview?Tell us what they asked. Reviewed before it goes in, never with your name.
Morgan Stanley interview guide

Know what Morgan Stanley asks before you walk in.

11 coding · 4 system design · 19 behavioral questions

Get Premium$49 a year · Cancel anytime
Or start freeNo card.

Get their questions first.

InterviewLegend is independent and not affiliated with or endorsed by any company it covers.