SQL for analysis
Asking the database directly: filtering, summarising, joining tables and window functions.
What this course covers
SQL is the language almost every data team uses to get numbers out of a database. This course starts with SELECT, WHERE, GROUP BY and JOIN, with real SQL you can run inside the lesson on a small online shop's data. It then covers how analytics tables are organised (facts, dimensions and grain), joins that do not inflate numbers, the aggregation patterns people ask for most, and window functions for rankings and running totals. Every query is checked against the right answer, including traps such as NULL and the WIB time zone.
New to AI? Start with AI & data fundamentals.
Part of the career paths:Data analystData engineerData scientist
What you will be able to do
- Write SELECT, WHERE, GROUP BY and JOIN queries that answer business questions
- Choose the right join and spot one that inflates numbers
- Read the fact-and-dimension structure of a data warehouse
- Use window functions for rankings, running totals and period-over-period comparisons
Units and bites
- Unit 15 bitesAbout 15 min
SQL basics
Asking the database directly: selecting, filtering, grouping and joining tables.
- 3 min
SELECT and WHERE
Taking the columns you need and filtering to the rows that matter.
- 3 min
GROUP BY and aggregates
SUM, COUNT and AVG per city or per month, and how WHERE differs from HAVING.
- 3 min
Joining tables
INNER and LEFT JOIN, and the join that quietly doubles your rows.
- 3 min
Dates and time zones
Cutting data by month correctly when the database stores time in UTC.
- 3 min
NULLs and edge cases
Why COUNT(*) and COUNT(column) differ, and how to handle missing values safely.
- Unit 25 bitesAbout 15 min
SQL & data modelling
Fact and dimension tables, grain, and schemas that make analysts fast and numbers consistent.
- 3 min
App tables vs analytics tables
Why a schema that suits the app does not necessarily suit reporting.
- 3 min
Facts and dimensions
The events you measure and the context that describes them: the star schema.
- 3 min
Choosing the grain
What does one row represent? The most important decision in a fact table.
- 3 min
Joins that inflate numbers
Joining orders to items and then summing the order total: a classic mistake.
- 3 min
Changing dimensions
A customer moves city: do old reports change with them, or stay as they were?
- Unit 34 bitesAbout 12 min
Joins in depth
INNER, LEFT, anti-joins and self-joins: choosing the join that answers the question, without losing or duplicating rows.
- 3 min
INNER and LEFT joins compared
Which join quietly drops customers with no orders, and when that is what you want.
- 3 min
Anti-joins: finding what's missing
Customers who never bought, products that never sold: LEFT JOIN ... WHERE ... IS NULL and NOT EXISTS.
- 3 min
Self-joins and repeat buyers
Joining a table to itself to find each customer's second order.
- 3 min
Joining on dates and ranges
Matching orders to the promotion running at the time, such as the 12.12 sale.
- Unit 44 bitesAbout 12 min
Aggregation and GROUP BY patterns
The summaries people ask for most: conditional aggregation, COUNT DISTINCT, by week and by month, and funnels.
- 3 min
Conditional aggregation with CASE
Paid revenue and cancelled orders in one query, one row per city.
- 3 min
COUNT DISTINCT pitfalls
Why daily unique buyers cannot be added up into monthly unique buyers.
- 3 min
Grouping by week and month
Truncating time in WIB, weeks that start on Monday, and months with no data.
- 3 min
Funnel counts in SQL
From product view to checkout to payment: counting each stage without counting anyone twice.
- Unit 54 bitesAbout 12 min
Window functions for analysis
Calculating alongside rows instead of collapsing them: rankings, running totals and period-over-period comparisons.
- 3 min
ROW_NUMBER for the latest record
Taking the latest row per customer, and removing duplicates safely.
- 3 min
Running totals
Cumulative revenue through Ramadan with SUM() OVER (ORDER BY ...).
- 3 min
LAG for period-over-period
Month-on-month growth without a self-join, and what happens in the first month.
- 3 min
Ranking within groups
The top three products in every city with PARTITION BY, and how RANK differs from DENSE_RANK.
Questions about this course
Learning
How long does SQL for analysis take?
About 66 minutes in all: 5 units made of 22 bites of about three minutes each, and every bite ends with a quick check. You can do one bite a day or several in a row.
Do I need to know how to code?
Not to start. The foundations explain every idea in plain words first; where a course uses SQL or Python, it teaches it from the beginning, with a playground in the lesson.
Where should I start?
If you are new to AI, begin with AI & data fundamentals. If you know the job you want, follow its career path; SQL for analysis has a place in it.
When can I start learning?
Datamew is coming to iOS and Android soon. There is no release date or price announced yet: join the waitlist and we will tell you when the app is out.
Is it available in Bahasa Indonesia?
Yes. Datamew is written in English and Bahasa Indonesia.
More courses
- AI & data fundamentalsHow AI works, how to instruct it, and how to read numbers honestly.
- Data analystHow analysts think and work: from a business question to an answer people use.
- Data engineerBuilding pipelines that deliver data on time and correct: SQL, Python, orchestration and warehouses.
- Data scientistWhat data scientists do, and how to use LLMs in the work.
- Data preparationFrom a raw export to a table you can trust: tidy shape, missing values, duplicates and formats.
- Data visualisationCharts that answer a question honestly, from picking the type to dashboards and stories.
- StatisticsThe statistics every data role uses: summarising, reading distributions and measuring uncertainty.
- Supervised and unsupervised learningThe two ways machines learn from data: with answers, and without them.
- Product recommendationsHow "you might also like" works, the data behind it, and how to prove it pays.
- A/B testingMeasuring whether a change really worked, with two random groups and an honestly read result.
- ForecastingForecast demand as a range, ready for Ramadan, 11.11 and 12.12.
- Customer segmentationSplitting customers into groups that differ, then treating each group differently.
- Social media analyticsRead Instagram, TikTok and YouTube numbers honestly, and use AI without being fooled.
- AI for finance reconciliationMatching bank statements to invoices: rules first, AI for the rest, people decide.
- AI for SEOHow search works in the age of AI answers, keyword research, Search Console, and writing with AI responsibly.
Read while you wait
Guides from the Datamew team, free on the web today.
How to Become a Data Analyst in Indonesia: Skills, Roadmap and Salary (2026)
To become a data analyst, learn spreadsheets, SQL, one BI tool such as Looker Studio or Power BI, basic statistics, and how to explain a finding in plain words. Most people can learn the basics in about six months part-time, then need two or three portfolio projects to get interviews. In Indonesia the average data analyst salary on Indeed is about Rp6.3 million a month.
8 min readHow to Become a Data Scientist in Indonesia: Skills, Roadmap and Salary (2026)
A data scientist uses Python, statistics and machine learning to predict what will happen and to test what works. Most people get there through data analysis first: learn SQL and statistics, then Python, experiments and machine learning, which takes roughly a year part-time. In Indonesia, data scientist salaries on Indeed average about Rp14.5 million a month.
8 min readBe first on the app
Leave your email and we will tell you the day Datamew lands on your phone. One email at launch, no spam.
- Coming soon onApp Store
- Coming soon onGoogle Play
- Use it now onthe web