Python / SQL / Data Manipulation
pandas fluency, basic SQL (SELECT/JOIN/GROUP BY), numpy from-scratch drills.
Start here
Practical fluency, not cleverness. Two toolkits matter:
- — math on whole arrays at once, very fast (no Python loops). builds on it: a is a spreadsheet you manipulate with code — filter rows, group + summarize, two tables on a shared column.
- SQL — same job, for data living in a database. SELECT picks columns, WHERE filters rows before grouping, buckets rows sharing a value, HAVING filters after that, combines tables on a shared column.
The viva-specific twist: you may be asked to implement something like "compute from predictions" using bare , no shortcuts — checking you understand what's inside the black box, not whether you memorized a one-line library call.
Core threads
- : filtering (`df[df.col > x]`), grouping (`groupby().agg()`), merging (`merge` = SQL equivalent), handling missing data (`fillna`/`dropna`) — these cover 90% of asked operations.
- SQL: SELECT + WHERE + + HAVING + (INNER vs LEFT — know the difference cold) is the expected level, not window functions or CTEs (though a bonus if you know them).
- from scratch: be able to implement, without sklearn: train/test split (shuffle + slice), // ( counts), and (distance matrix + argsort + majority vote). These are classic "write it live" prompts because they test understanding, not memorization of an API.
- Why "from scratch" matters: a candidate who can only call `sklearn.metrics.accuracy_score` but can't say what it computes internally raises a flag — the board is testing understanding through implementation.
Viva angle
If asked to write /SQL on paper, narrate your reasoning (which column, why groupby, why that type) — it shows understanding even if exact syntax slips.
Visual reference
INNER vs LEFT JOIN
Cheatsheet
SQL clause order
| Clause | Purpose |
|---|---|
| SELECT | Pick columns |
| WHERE | Filter rows before grouping |
| GROUP BY | Bucket rows sharing a value |
| HAVING | Filter after grouping (on aggregates) |
| ORDER BY | Sort results |
JOIN types
| Type | Returns |
|---|---|
| INNER JOIN | Only rows matching in both tables |
| LEFT JOIN | All left rows, NULLs where no match on the right |
pandas quick reference
| Task | Code |
|---|---|
| Filter rows | df[df.col > x] |
| Group + aggregate | df.groupby('col').agg(...) |
| Join two tables | df.merge(other, on='key') |
| Fill missing | df.fillna(value) |
- ▸ core: distances → np.argsort → majority vote of nearest K labels.
- ▸Always shuffle before a train/test split unless order is meaningful (time series).
Further study
Question bank
17 questionsDescribe how you would implement a train/test split from scratch using (no sklearn).
Describe how to compute , , and from scratch given predicted and true labels.
Describe how to implement classification from scratch.
How do you handle missing values in a ? Name a few strategies.
What does groupby().agg() do in ? Give an example use case.
What is the difference between INNER and LEFT in SQL?
Write a SQL query to find the top 3 users by total transaction amount from a `transactions(user_id, amount, created_at)` table.
What is the difference between WHERE and HAVING in SQL?
Write Python code (or describe it) to find all divisors of a number N efficiently.
What is the difference between a Python list and a array, performance-wise?
What can ROW_NUMBER() or () (window functions) do that a plain can't?
What is the difference between a SQL subquery and a CTE (the WITH clause), and why are CTEs often preferred?
What does ' pivot_table do, and when would you use it?
What does 'vectorization' mean in general, beyond just , and why is it faster than an explicit loop?
Why do indexes speed up SQL queries — what's the mental ?
What changes when you multiple columns instead of one, and what's an example use case?
Write a SQL query to find duplicate values in a column — e.g. users sharing the same phone number.