Aptitude · Tech basics
Coding, SQL and Git basics, made easy
💡 The idea
Most basic coding questions are about tracing: follow the code (or the SQL) one line at a time and write down the values as they change.
Read one line→Write the values→Next line→Answer
🧭 The method: 3 steps
- OOP: encapsulation (hide data), inheritance (reuse a class), polymorphism (same method, different behaviour).
- SQL: WHERE picks the rows, then COUNT counts them and SUM adds a column.
- Git: add → commit (save locally) → push (send to the server); pull brings changes down.
🎬 Every kind of question, in pictures
Pick a kind. Guess the answer first, then watch the picture work it out. Tap any step to see it in the picture.
Loading the pictures…
✏️ Worked examples
Example 1. SELECT COUNT(*) FROM orders WHERE amount > 100; amounts 50, 120, 300, 100
- Rows above 100: 120 and 300
- 100 is not MORE than 100
⚡ Shortcut: 2
⚠️ Where people go wrong
- “> 100” does not include 100; “>= 100” does.
- range(3) is 0, 1, 2: three values, not four.
- commit does not upload: push does.
📌 Remember
- WHERE → COUNT / SUM
- range(n) runs n times
- add · commit · push