Elektrine lite

← Feed

Jamal Hansen

ham_jansen@mastodon.online

<p>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&#39;t fallen apart yet.</p>

Posts

  • View post

    Every query in SQL for Python Devs returned all the rows. That&amp;#39;s fine for learning, but it&amp;#39;s wasting bandwidth and processing power. WHERE filters rows before they ever leave the database. It&amp;#39;s the SQL equivalent of Python&amp;#39;s list comprehension if clause: [c for c in customers if c[&amp;#39;is_premium&amp;#39;]] This week covers WHERE and its friends AND, OR, IN, BETWEEN, LIKE, and the quirky IS NULL syntax. https://jamalhansen.com/blog/where-filtering-your-dat...

  • View post

    SQuizL 04-MAR-26 1/6 guesses 319 seconds 🟩🟩🟩🟩🟩🟩🟩 https://bit.ly/SQuizL-game #SQuizL #SQL

  • View post

    How many customers are in each city? If you&amp;#39;re pulling all the rows into Python and using Counter or pandas groupby(), you&amp;#39;re doing too much work. SQL&amp;#39;s GROUP BY does the counting on the database server and sends back just the summary. Five cities? Five rows returned. Not 10,000. Read more about GROUP BY, aggregate functions (COUNT, SUM, AVG, MIN, MAX), and the golden rule of grouping. https://jamalhansen.com/blog/group-by-aggregating-your-data #SQL #Python #DuckDB #D...

  • View post

    Good Morning! It&amp;#39;s my first #tsql2sday Today, it&amp;#39;s about the risks taken in my career. https://jamalhansen.com/blog/tsql-tuesday-196-what-career-risks-have-you-taken/

  • View post

    Ever tried filtering on COUNT() with WHERE and hit a confusing error? The problem: WHERE runs before GROUP BY, so aggregate functions don&amp;#39;t exist yet. That&amp;#39;s where HAVING comes in. It filters after grouping. WHERE = filter individual rows HAVING = filter aggregates Read more: https://jamalhansen.com/blog/having-filtering-grouped-results #SQL #Python #DuckDB #DataScience #Programming

  • View post

    I built an AI persona for my blog. This week, he published his first post. His name is BartBot. He monitors RSS feeds, scores articles with a local LLM, and surfaces the ~0.7% worth reading. I&amp;#39;m not sure if he&amp;#39;s useful, annoying, or both. He&amp;#39;s not sure either. https://jamalhansen.com/blog/the-content-curator/ #LocalAI #AITools #BuildInPublic #ContentCuration #PKM #RSSFeed #BartBot

  • View post

    SQL subqueries are confusing until you realize they&amp;#39;re just helper functions. In Python, when you need an intermediate result, you write a helper function. In SQL, you nest a query inside another query. Same idea, different syntax. This week&amp;#39;s SQL for Python Developers post covers the three types of subqueries , where they can appear in your SQL, and the difference between correlated and non-correlated subqueries. https://jamalhansen.com/blog/subqueries-when-sql-needs-helper-f...

  • View post

    @stackreport@techhub.social The markdown formatting makes them easy to automate or generate if that&amp;#39;s appealing. The ability to wikilink is powerful.

  • View post

    Nested subqueries force you to read SQL inside-out. That&amp;#39;s fine for two levels of nesting, but it falls apart fast. CTEs (Common Table Expressions) add the WITH keyword, which lets you name your subqueries and read your SQL top-to-bottom. Python developers already do this instinctively. CTEs are the SQL version of extracting named intermediate variables for clarity. https://jamalhansen.com/blog/ctes-making-your-sql-readable #SQL #Python #DuckDB #DataScience #Programming