SQL Functions Every Data Analyst Beginner MUST Know
1. AGGREGATE FUNCTIONS
Turn many rows into one number:
COUNT(*) → count rows
SUM(sales) → total
AVG(salary) → average
MIN/MAX(price) → lowest/highest
2. STRING FUNCTIONS
Clean & manipulate text:
UPPER/LOWER(name) → change case
TRIM(name) → remove spaces
LENGTH(name) → count characters
CONCAT(first, last) → join text
SUBSTRING(name, 1, 3) → slice text
REPLACE(col, 'old', 'new') → swap text
3. DATE FUNCTIONS
Work with time data:
NOW() → current timestamp
YEAR/MONTH/DAY(date) → extract parts
DATEDIFF(date1, date2) → days between
DATE_FORMAT(date, '%Y-%m') → format it
4. CONDITIONAL FUNCTIONS
Add logic to your queries:
CASE WHEN salary > 5000 THEN 'High' ELSE 'Low' END
COALESCE(col, 'default') → handle NULLs
NULLIF(a, b) → return NULL if equal
IIF(condition, true, false)
5. WINDOW FUNCTIONS
The analyst’s superpower:
ROW_NUMBER() → rank each row
RANK() → rank with gaps
DENSE_RANK() → rank no gaps
LAG/LEAD(col) → previous/next row value
SUM() OVER(PARTITION BY dept) → group totals without collapsing rows
6. GROUP BY + HAVING
Aggregate + filter groups:
GROUP BY department
HAVING COUNT(*) > 5 ← filters AFTER grouping
(WHERE filters BEFORE grouping)
7. JOINS (the most important)
INNER JOIN → only matches
LEFT JOIN → all left + matches
RIGHT JOIN → all right + matches
FULL JOIN → everything
Pro tip: Master these in this order:
SELECT → WHERE → GROUP BY → JOIN → CASE → Window Functions
That’s the roadmap from beginner → job-ready analyst.
A–Z of Excel Functions👇:
A – AVERAGE()
Calculates the average of a range of values.
B – COUNTBLANK()
Counts empty cells in a range.
C – COUNT()
Counts numeric values in a range.
D – DATE()
Creates a date from year, month, and day.
E – EXACT()
Checks if two text values are exactly the same.
F – FIND()
Finds position of text within another text (case-sensitive).
G – CONCAT()
Combines text from multiple cells.
H – HLOOKUP()
Searches data horizontally in a table.
I – IF()
Performs logical test and returns value based on condition.
J – JOIN (TEXTJOIN())
Combines text with delimiter.
K – LARGE()
Returns the nth largest value.
L – LEFT()
Extracts characters from left side of text.
M – MAX()
Returns highest value.
N – NOW()
Returns current date and time.
O – OR()
Returns TRUE if any condition is true.
P – PMT()
Calculates loan payment amount.
Q – QUARTILE()
Returns quartile value of dataset.
R – RIGHT()
Extracts characters from right side of text.
S – SUM()
Adds values in a range.
T – TRIM()
Removes extra spaces from text.
U – UPPER()
Converts text to uppercase.
V – VLOOKUP()
Searches data vertically in a table.
W – WEEKDAY()
Returns day of week from a date.
X – XLOOKUP()
Modern lookup function replacing VLOOKUP/HLOOKUP.
Y – YEAR()
Extracts year from date.
Z – Z.TEST()
Returns probability value for z-test.
#Dataanlytics