NIT Data Skills Guide Beginner SQL · 2026
What Is SQL for Data Analysis?
Question → query → checked result → interpretation
Learn why Data Analysts use SQL, how a database question becomes a query, and how to check whether the answer is safe to trust—using simple school, payment and business examples.
SQL analyst view
What is SQL for data analysis?
SQL (Structured Query Language) is a language used to work with data stored in relational databases. A Data Analyst uses SQL to retrieve selected records, filter them, combine related tables, calculate summaries and answer defined questions using data. PostgreSQL documents the core query process around table expressions, filtering, grouping and result selection, while Microsoft classifies introductory SQL querying as a beginner Data Analyst skill. [1] [4]
The database stores the records. SQL gives the analyst a precise way to ask those records a question.
Imagine a school with 40,000 examination records, a finance office with thousands of payments, or a retailer with several years of transactions. The information may already exist. The analyst’s task is to retrieve the right part, check it and explain what it means.
Start with the thinking
A Data Analyst starts with a question—not a SQL command
Suppose someone asks: “What was the average Mathematics score for Form 4?” Before touching SQL, identify what the answer requires: the subject, the class level and the score field. Then translate that logic into a query.
Beginner rule
Do not memorise SQL as a list of keywords. Learn to connect each command to a question the data needs to answer.
Database foundations
SQL, a database and a table are not the same thing
Database
An organised collection of information managed by a database system. A school database might contain students, courses, results, attendance and payments.
Table
A structured set of related records inside the database. Rows represent records; columns represent fields such as student name, course or score.
SQL
The language used to ask relational database systems for information and perform other supported database operations.
Microsoft’s introductory material teaches relational databases, SQL, the SELECT statement, data types and NULL handling as connected foundations. [4]
Your first query
Read a basic SQL query almost like a sentence
Suppose a students table contains student names and courses. You want only Data Science students.
SELECT
Choose the columns you want returned: student_name and course.
FROM
Tell the database which table contains those columns: students.
WHERE
Keep only rows where the course is exactly Data Science.
Result
The output contains only records that satisfy the condition. The query has converted a human question into a database request.
Core SQL tools
The SQL features a beginner Data Analyst should recognise
You do not need the whole SQL language before you can perform useful analysis. Start with a small set of features and understand the job each one performs.
| SQL feature | Analytical purpose | Simple question |
|---|---|---|
SELECT | Choose information to return. | Which columns do I need? |
WHERE | Filter individual rows. | Which records belong in the analysis? |
ORDER BY | Sort the result. | Which value is highest or lowest? |
COUNT() | Count records or non-NULL values. | How many orders were recorded? |
SUM() | Add numerical values. | What were total sales? |
AVG() | Calculate an average. | What was the average score? |
GROUP BY | Calculate summaries for separate categories. | What is the average score by subject? |
HAVING | Filter groups after grouping. | Which branches have sales above a grouped threshold? |
JOIN | Connect related tables. | Which customer placed each order? |
LEFT JOIN | Keep left-table records even when no match exists. | Which students have no payment record? |
IS NULL | Find missing or unknown values. | Which records have no score entered? |
PostgreSQL documents WHERE, GROUP BY and HAVING as distinct stages in shaping a query result. [1]
Worked example 1 · school data
Find the average Mathematics score for Form 4
| Student | Class | Subject / score |
|---|---|---|
| Amina | Form 4 | Mathematics · 78 |
| Brian | Form 4 | Mathematics · 62 |
| Faith | Form 4 | English · 81 |
| Kevin | Form 4 | Mathematics · 55 |
| Mary | Form 3 | Mathematics · 71 |
Measure
We need an average, so use AVG(score).
Subject
Include Mathematics records only.
Class
Include Form 4 records only.
Check
Make sure Form 3 Mathematics and Form 4 English are excluded.
Expected result: 65
The included Mathematics scores are 78, 62 and 55. Their average is (78 + 62 + 55) ÷ 3 = 65. If Mary’s Form 3 score were included, the query could still run but would answer a different question.
Now compare average scores by subject
When the question changes from one subject to each subject, use GROUP BY.
PostgreSQL explains grouping as the mechanism for collecting rows that share a grouping value so aggregate calculations can be produced for each group. [1]
Do not confuse a result with an explanation
If Chemistry has the lowest average, SQL has shown a difference in the records. It has not proved why that difference exists. Examination difficulty, missing marks, different learner groups or data-quality problems may still need investigation.
Worked example 2 · payments
How much has every student paid?
Relational databases often separate information into related tables. A student table may contain names while a payment table stores transactions. A shared student_id connects the records.
| Student ID | Student | Payment records |
|---|---|---|
| 101 | Amina | KSh 10,000 + KSh 8,000 |
| 102 | Brian | KSh 15,000 |
| 103 | Faith | KSh 12,000 |
| 104 | Kevin | No matching payment row |
The wording “every student” matters. An ordinary inner join would omit Kevin because he has no matching payment row. A LEFT JOIN keeps every student from the left table and represents unmatched payment fields as NULL. PostgreSQL documents this outer-join behaviour directly. [2]
| Student | Total paid | Why this row appears |
|---|---|---|
| Amina | KSh 18,000 | Two matching payment rows |
| Brian | KSh 15,000 | One matching payment row |
| Faith | KSh 12,000 | One matching payment row |
| Kevin | KSh 0 | No matching payment row; LEFT JOIN keeps the student and COALESCE displays zero |
SQL correctness includes logic—not only syntax. The join type must match the records the question expects to keep.
Data quality
NULL does not automatically mean zero
A missing score may be represented as NULL. That means the value is missing or unknown in the data; it is not automatically the numeric value 0.
With four rows where one score is NULL, COUNT(*) returns 4 while COUNT(score) returns 3 because COUNT(column) counts only non-NULL values. PostgreSQL’s aggregate-function documentation specifies this distinction. [3]
Why this matters
A beginner who treats missing information as zero can distort averages, completion rates, balances and other summaries. Always decide what a missing value means in the context of the data.
Worked example 3 · business data
Which product category generated the most recorded revenue?
Suppose each sales row contains a product category, quantity and unit price. Revenue for a row can be calculated as quantity × unit_price, then grouped by category.
Result
Which category has the largest calculated revenue total?
Period
Does the query cover the correct date range?
Definition
Is unit price the actual selling price, and are refunds represented?
Decision
High revenue does not automatically mean high profit or future demand.
Analytical quality control
Five checks before you trust a SQL result
A useful query is not merely one that executes
Before reporting an answer, make sure the query matches the question and the underlying records behave as expected.
- Row meaning: know whether one row represents a student, payment, order, item or another unit.
- Filters: verify dates, locations, status fields and categories.
- Missing values: check how NULLs affect counts, averages and joins.
- Join behaviour: compare row counts and check whether matches duplicate or remove records.
- Interpretation: state what the result supports without inventing a cause the data does not prove.
Beyond syntax
Why a Data Analyst needs more than SQL commands
- 01Define the question
What decision or comparison is the analysis supposed to support?
- 02Find the evidence
Which tables and columns actually contain the required information?
- 03Choose the records
Which rows should be included or excluded?
- 04Calculate correctly
Does the question need a count, total, average, group, rate or comparison?
- 05Check the result
Are there duplicates, missing values, surprising row counts or impossible totals?
- 06Explain carefully
What does the evidence show, and what does it not prove?
Beginner progression
How much SQL should a beginner Data Analyst learn first?
- Foundation
Tables, rows, columns, keys, relationships and NULL. - Query
SELECT,FROM,WHEREand sorting. - Summarise
COUNT,SUM,AVG, grouping andHAVING. - Connect
Inner joins, left joins and row-count checks. - Progress
CASE, dates, subqueries, CTEs and window functions.
Microsoft’s beginner Transact-SQL path is explicitly aimed at roles including Data Analyst and starts from relational data and core querying rather than requiring prior Python knowledge. [4]
Kenya labour-market context
Is SQL relevant to Data Analysts in Kenya?
Yes. A Kenya ICT employment study by Genesis Analytics, developed with the ICT Authority of Kenya and GIZ, estimated about 27,000 professionals in Kenya’s broader Data Science & Analytics job family and explicitly listed SQL among Data Analyst skills. [5]
The 56.25% figure should be read precisely: in Figure 12 of the study, 56.25% of employers represented in that competency analysis indicated SQL and Database Management as a skill area lacking across Data Science and Analytics competencies. It is not a claim that 56.25% of every employer in Kenya requires SQL. [5]
SQL in the AI era
Does AI make SQL unnecessary?
No. AI tools can generate or explain SQL, but the analyst still needs to verify whether the generated query matches the question and data.
Tables
Did the tool use the correct tables and relationships?
Joins
Could the join remove records or multiply rows unexpectedly?
Filters
Are the date range, branch, status and category conditions correct?
Meaning
Does the result answer the actual question rather than a plausible-looking different one?
The Kenya ICT employment study expects AI to augment Data Science and Analytics work and describes a shift toward higher-level problem solving, interpretation and drawing insights from data. [5]
Where SQL fits
How SQL works with Excel, Python and Power BI
A real workflow does not always need every tool. SQL is especially useful when the records you need live in a relational database. NIT’s broader Data Analytics learning guide covers the Excel → SQL → Python → Power BI progression in detail, so this article stays focused on SQL itself. [6]
Try it yourself
Beginner SQL practice challenge
Use this fictional orders table:
| Order | Customer / town | Amount |
|---|---|---|
| 1 | Amina · Migori | KSh 2,500 |
| 2 | Brian · Kisii | KSh 1,800 |
| 3 | Faith · Migori | KSh 4,100 |
| 4 | Kevin · Migori | KSh 1,200 |
| 5 | Mary · Kisii | KSh 3,000 |
Question
Which customers from Migori have an order above KSh 2,000? Before reading the solution, identify the required columns, the town condition and the amount condition.
The result contains Amina and Faith. Kevin matches the town but not the amount condition; Mary matches the amount but not the town. Understanding why each row is included or excluded is more useful than memorising the query.
Reusable method
The beginner SQL mental model
Use this sequence whenever you meet a new analysis question
It keeps your attention on the evidence and logic instead of jumping straight into syntax.
- Define exactly what you are trying to find out.
- Identify the table or tables containing the evidence.
- Understand what one row represents.
- Choose only the fields you need.
- Filter the correct records.
- Join tables only when required and check what the join changes.
- Calculate the appropriate count, total, average or grouped measure.
- Check missing values, duplicates and unexpected outputs.
- Interpret the answer without claiming more than the records support.
Frequently asked questions
SQL for Data Analysis: common beginner questions
What does SQL stand for?
SQL stands for Structured Query Language. It is used to interact with relational database systems. [4]
Why is SQL useful for Data Analysis?
It lets analysts retrieve, filter, group, summarise and combine structured database records so they can answer defined questions from organisational data.
Do all Data Analysts use SQL?
No. Tool use depends on the organisation and role. SQL is especially relevant when important records are stored in relational databases. Kenya-focused labour-market evidence explicitly lists SQL among Data Analyst skills. [5]
Can I learn SQL without Python?
Yes. Python is not a prerequisite for basic SQL. Microsoft’s introductory SQL module is beginner level and lists familiarity with tabular data, such as a spreadsheet, as useful preparation. [4]
What is the difference between WHERE and HAVING?
WHERE filters individual rows before grouping. HAVING filters groups after GROUP BY. [1]
What is a JOIN?
A JOIN connects related information stored in separate tables using a matching condition. An outer join such as LEFT JOIN can retain unmatched rows from one side. [2]
What does NULL mean?
NULL represents a missing or unknown value. It is not automatically the same thing as zero or an empty string. [3]
Is knowing SQL enough to become a Data Analyst?
No. SQL is one technical skill. Analysts also need data-quality judgement, interpretation, communication and other tools appropriate to their work. The Kenya ICT employment study lists communication, business knowledge, Data Visualisation and Excel alongside SQL for Data Analysts. [5]
Can AI write SQL for me?
AI can assist with SQL, but you still need to verify the tables, joins, filters, calculations and meaning of the result. A plausible query can be logically wrong even when it executes.
Main lesson
SQL matters because it turns stored records into answerable questions
Do not measure your progress by the number of commands you can recite. Measure it by whether you can take a question, identify the right records, write a query, check the result and explain what the evidence actually supports.
Question → correct data → correct query → checked result → defensible interpretation.
Admissions · Newton Institute of Technology
Learn Data Science & Analytics at NIT
NIT’s Data Science & Analytics programme develops practical skills in Excel, statistics, SQL, Python, data cleaning, visualisation, introductory Machine Learning and project work. The current pathway is six months of institutional training followed by a compulsory three-month industrial attachment, with physical and online study options. [7]
Training pathway6 months institutional training + 3-month compulsory attachment
Study optionsPhysical · evening · online
Contact+254 713 584 858 · Migori Town, Kenya
Sources and references
- PostgreSQL Global Development Group — PostgreSQL 18 Documentation: Table Expressions. Primary technical documentation for
WHERE,GROUP BY,HAVINGand grouped query logic. PostgreSQL documentation. - PostgreSQL Global Development Group — PostgreSQL Tutorial: Joins Between Tables. Primary technical documentation for inner joins, outer joins and preservation of unmatched rows. PostgreSQL join tutorial.
- PostgreSQL Global Development Group — Aggregate Functions. Primary technical documentation for
COUNT,SUM,AVGand NULL-sensitive aggregate behaviour. PostgreSQL aggregate functions. - Microsoft Learn — Introduction to Transact-SQL. Beginner reference for relational databases, SQL,
SELECT, data types and NULL handling; Data Analyst is listed among the intended roles. Microsoft Learn. - Genesis Analytics / ICT Authority of Kenya / GIZ — Unlocking Current and Future Employment for ICT Professionals in Kenya. Kenya-specific evidence for the Data Science & Analytics workforce, SQL among Data Analyst skills, employer competency gaps and expected AI augmentation. Read the report.
- Newton Institute of Technology — Online Data Analytics Courses in Africa: Excel, SQL, Python & Power BI. Internal supporting guide for the wider analytics-tool learning pathway. Read the NIT guide.
- Newton Institute of Technology — Data Science and Analytics Course in Kenya. Current programme information for curriculum, institutional training, compulsory industrial attachment and study options. View the programme.
Prepared by: Newton Institute of Technology Editorial Team · Technical review: Engineer Simon Barongo · Last reviewed: 29 October 2026.