Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

MJ ANALYTICS

Manoj Kumar

5
SQL FUNCTIONS
EVERY DATA ANALYST
SHOULD MASTER

https://www.linkedin.com/in/mk-analytics
MJ ANALYTICS

Manoj Kumar

SQL functions are pre-built routines that perform


common data operations.

Mastering the right functions will make you a better,


faster SQL programmer.

Here are 5 must-know functions:

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

1. Aggregate Functions

Aggregate functions perform calculations on groups of


rows and return a single value.

Examples:

COUNT() - Count number of rows


MAX() - Maximum value
AVG() - Average value
SUM() - Sum of values

These are indispensable for performing analytics.

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

2. Window Functions

Window functions apply calculations across sets of rows


without collapsing into a single value.

Examples:

RANK() - Rank each row by value


LAG() - Pull value from previous row
ROW_NUMBER() - Number each row

Useful for data science tasks like feature engineering.

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

3. String Functions

String functions operate on string data types to


manipulate text values.

Examples:

UPPER() - Convert to upper case


CONCAT() - Concatenate strings
SUBSTRING() - Extract substrings

Great for data cleaning and shaping.

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

4. Date Functions

Date functions transform and manipulate date/time


values.

Examples:

NOW() - Current date and time


DATE_ADD() - Add/subtract date parts
DATEDIFF() - Calculate difference between dates

Essential for working with temporal data.

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

5. Conditional Functions

Conditional functions return values conditionally based


on criteria.

Examples:

CASE WHEN - Case logic


IFNULL() - Return value if NULL
COALESCE() - Return first non-NULL value

Enable flexible, customizable logic within queries.

Get comfortable using these 5 categories of functions,


and you'll be able to handle most data analysis tasks in
SQL! Let me know if you have any other questions.

https://www.linkedin.com/in/mk-analytics/
MJ ANALYTICS

Manoj Kumar

LOOKING FOR REAL-


WORLD EXPERIENCE IN
DATA ANALYTICS?

DM ME ON LINKEDIN TO KNOW MORE


OR
USE 'BOOK A 1:1 CALL' LINK IN MY
PROFILE BIO

https://www.linkedin.com/in/mk-analytics

You might also like