Alex The Analyst

The 4 Real Levels of SQL...

Level 1: The "Beginner"

```
SELECT customer_id, name, email
FROM customers
WHERE country = 'USA';
```

Level 2: The "Just Completed a Course"

```
SELECT r.region_name, COUNT(DISTINCT o.order_id) AS order_count
FROM orders o
JOIN regions r ON o.region_id = r.region_id
WHERE o.order_date >= '2024-01-01'
GROUP BY r.region_name
ORDER BY order_count DESC;
```

Level 3: The "Landed Your First Job"

```
SELECT customer_id,
order_id,
order_total,
order_date,
RANK() OVER (PARTITION BY customer_id ORDER BY order_total DESC) AS rank_by_spend,
CASE
WHEN order_total > 500 THEN 'High Value'
WHEN order_total BETWEEN 200 AND 500 THEN 'Medium Value'
ELSE 'Low Value'
END AS order_tier
FROM orders
WHERE order_status = 'Completed'
AND order_date BETWEEN '2024-01-01' AND '2024-12-31';
```

Level 4: The "Used to for Years"

```
CREATE TEMP TABLE high_value_customers AS
SELECT
customer_id
FROM orders
WHERE order_total IS NOT NULL
GROUP BY customer_id
HAVING SUM(order_total) > 20000
AND COUNT(DISTINCT order_id) >= 5;

WITH recent_orders AS (
SELECT *
FROM orders
WHERE order_date >= CURRENT_DATE - INTERVAL '90 days'
AND order_total > 0
AND order_status IN ('Completed', 'Shipped')
),
clean_customers AS (
SELECT
customer_id,
INITCAP(name) AS name_cleaned,
LOWER(TRIM(email)) AS email_cleaned,
COALESCE(loyalty_status, 'Standard') AS loyalty_status
FROM customers
WHERE email IS NOT NULL
),
enriched_orders AS (
SELECT
ro.order_id,
ro.customer_id,
ro.order_date,
ro.order_total,
ro.product_id,
cc.name_cleaned,
cc.email_cleaned,
cc.loyalty_status
FROM recent_orders ro
JOIN clean_customers cc ON ro.customer_id = cc.customer_id
),
orders_with_products AS (
SELECT eo.*, p.product_name, p.category
FROM enriched_orders eo
LEFT JOIN products p ON eo.product_id = p.product_id
)
SELECT *
FROM orders_with_products
WHERE customer_id IN (SELECT customer_id FROM high_value_customers)
ORDER BY order_total DESC, order_date DESC;
```

1 week ago | [YT] | 1,125



@MsVeeVee7

I got comfortably to level 2 through self-studying, no defined course (your videos of course are of great help) however getting a mentor at my work and having real data to play with has sky-rocketed my understanding in just a few weeks.

1 week ago | 46  

@AntonyoZkez

Somehow got to level 4 still thinking I was level 1. My boss is a next level gaslighter lol.

1 week ago | 30  

@happinessalerah1809

Level 3 but haven't landed their first job saying hiiiii 🀣....thanks Alex your videos have been helpful ❀

1 week ago | 1

@sailyourface

I mostly agree with all of the levels but 3 years in I still use level 3 90% of the time. IMO the day-to-day is a lot less complicated than people think.

1 week ago | 9

@samuelowusuannor8256

Mr. Alex, your impact on my life can't be measured. Thanks a lot for the tutorials. They're really educative and easy to understand. God bless you. From Ghana πŸ‡¬

1 week ago | 2

@_MeeYuh_

I love a good CTE ! It is life changing ! Thank you Alex for changing lives everyday πŸ‘

1 week ago | 2

@shatayupatil1617

It's been more than 2 years working as a data analyst and more than 1 year using CTEs on regular basis (bigquery)πŸ™‚

1 week ago | 8

@santoshbhattarai2527

Have written queries similar to level 3 and has not yet landed a job. So I need to understand the business now.

1 week ago | 2

@lavatr8322

Holy FOCK, the "just got a job" already scares me

6 days ago | 1

@veetoria-toms

🀣🀣Alex!!! Level 2 peers, let's all say 'H

1 week ago | 7

@oziluvibezim1175

Yep, pretty accurate πŸ˜‚

1 week ago | 0

@afianidewi1993

Still at level 2, but I’m practicing hard to reach level 3 and land my first job soon. Trust the process ✨

1 week ago | 2

@thisishowHEdidit

Ah, yes...I love this!! πŸ‘πŸΎπŸ‘πŸΎπŸ‘πŸΎ

1 week ago | 2  

@gabrielevetrugno6089

Totally agree with the 4th one!

1 week ago | 2  

@Xoundz

True, but m always on level 1 or 2. I wish i could learn and practice level 3 & 4.

1 week ago | 1

@Get_Some_Panda

Wow Level 4 looks crazy

1 week ago | 5

@geewill99

Self taught and I'm at level 1, gotta start somewhere I guess.

1 week ago | 3

@disruptingthestatusquo

I’m comfortable at level 2 with some tutorials and courses, and pretty sure I can get going at level 3 as soon as I get my first data analyst job

1 week ago | 1

@Markus7A

Level 6 here✌️😎

1 week ago | 3

@mathewhutchins2539

In the transition from level 3 to level 4. Currently a DA II in healthcare. What salary range would you expect for someone firmly in the level 4 range

1 week ago | 7