Jamal Hansen's Avatar

Jamal Hansen

@ham-jansen

Data scientist and team lead. I write about SQL, Python, and practical AI at jamalhansen.com. 5 kids, an MBA, and a blog publishing schedule that somehow hasn't fallen apart yet.

48
Followers
1,021
Following
15
Posts
30.10.2024
Joined
Posts Following

Latest posts by Jamal Hansen @ham-jansen

Preview
T-SQL Tuesday #196 - What career risks have you taken? My first time participating in t-SQL Tuesday, answering the question, what career risks have you taken?

Hi everyone! It's my first #tsql2sday. Here is my post and have a great day!

jamalhansen.com/blog/tsql-tu...

10.03.2026 10:26 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
GROUP BY: Aggregating Your Data GROUP BY creates buckets and counts them. It's like Python's `collections.Counter` or pandas `groupby()`. Learn COUNT, SUM, AVG, MIN, and MAX.

Don't pull rows into Python to count them.

Counter(c['city'] for c in customers) works, but sends every record over the network.

SQL's GROUP BY does it on the server:
SELECT city, COUNT(*) FROM customers GROUP BY city

Five groups = five rows.

Read more:

jamalhansen.com/blog/group-b...

09.03.2026 17:23 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
WHERE: Filtering Your Data Filter rows with conditions, the SQL equivalent of list comprehension `if` clauses. Covers AND/OR, IN, BETWEEN, LIKE patterns, and NULL handling.

SQL's WHERE filters rows before they leave the database

Python: [c for c in customers if c['is_premium']]
SQL: SELECT * FROM customers WHERE is_premium = true

Same, but SQL filters on the server.

jamalhansen.com/blog/where-f...

02.03.2026 14:40 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
ORDER BY: Sorting Your Results SQL returns rows in no guaranteed order. Run the same query twice and you might get different results. ORDER BY gives you control, like Python's sorted() with key functions.

Run a SQL query twice. Get different row orders. Not a bug.

Databases optimize execution differently each time. If order matters, you have to be explicit with ORDER BY

SQL's advantage over Python here: mixed sort directions in one line. ORDER BY date DESC, name ASC

jamalhansen.com/blog/order-b...

23.02.2026 15:34 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Jamal Hansen Technical blog exploring SQL, Python, and AI development

I write a weekly blog series called SQL for Python Developers, publishing weekly.

The idea is simple: if you already think in Python, SQL doesn't have to feel foreign.

If you write, teach, or build in this space, say hi!

jamalhansen.com

20.02.2026 21:17 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

New here (well, new-ish). I'm Jamal. Data scientist, blogger, dad of 5, MBA student. Currently on paternity leave, which means I have one hand on a baby and the other on a keyboard at all times.

Looking to connect with folks in the data/Python/SQL space.

20.02.2026 21:16 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
SELECT: Choosing Your Columns SQL's SELECT is more than picking columns. Rename with AS, compute expressions, and use DISTINCT for unique values.

SELECT * returns everything. You probably only need two columns.

But SELECT does more than pick columns. It renames with AS, computes expressions, and transforms text. It maps directly to Python list comprehensions.

DISTINCT can mask problems in your query. Why?

jamalhansen.com/blog/select-...

16.02.2026 22:06 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
SQL for Python Developers Learn SQL fundamentals using DuckDB and Python. A practical series for Python developers who want to level up their data skills.

So far, I've covered some basic topics to get started, and now we are getting down to business.

Coming up, we have lots of great topics including: GROUP BY, NULLs, JOINs, subqueries, CTEs, window functions, and more.

New posts every Monday at jamalhansen.com/series/sql-for-python-developers/

15.02.2026 14:38 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

SQL can be difficult to learn because it doesn't work like Python.

You don't give it steps. You describe the dataset you want, and SQL figures out how to return it.

Once that clicked for me, SQL became elegant.

This series is built around making SQL elegant so that it clicks for you.

15.02.2026 14:37 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

I'm writing a free weekly series: SQL for Python Developers. 25 posts, 6 published so far.

Every concept gets a Python comparison. Every post uses DuckDB so you can follow along with just pip install.

If you write Python and avoid SQL, this is for you. ๐Ÿงต

15.02.2026 14:33 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Iโ€™ve scheduled my AWS Certified Data Engineer โ€“ Associate (DEA-C01) exam for May 9. Wish me luck!

- Udemy Training - www.udemy.com/course/aws-c...
- 50% Discount - pages.awscloud.com/GLOBAL-other...
- Certification - aws.amazon.com/certificatio...

#AwsCertified #DataEngineer

19.04.2025 16:09 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Bat! ๐Ÿฆ‡

09.11.2024 01:21 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Awesome! Glad to hear that I made a good choice. There are so many options out there.

03.11.2024 19:35 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Today I decided to learn Go. Just starting out and discovered that the compiler comes with dependency manager, test runner, formatter, etc.

Ok, Iโ€™m curious to know more!
#golang

02.11.2024 20:41 ๐Ÿ‘ 5 ๐Ÿ” 0 ๐Ÿ’ฌ 2 ๐Ÿ“Œ 0
Post image Post image Post image

So happy to have the opportunity to attend my first All Things Open conference this year #AllThingsOpen.

30.10.2024 00:12 ๐Ÿ‘ 7 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0