Blog

Guides & Tutorials

Step-by-step articles on MCP servers, AI + database integrations, and more. — Page 2

Why Your AI's Customer Count Includes People You Already Deleted

Asked for active customers and the number is high. The table never DELETEs — it sets deleted_at. The AI counted every row. Soft-deleted, archived, and cancelled records look like live ones until you filter them.

September 21, 2026

Why Your AI's 'Top 10 Customers' Changes Every Time You Ask

Asked for the top 10 customers and got a different ten the next day — or a different ten in the same hour. LIMIT 10 without ORDER BY is heap order, not 'best.' The query is valid. The ranking is not.

September 21, 2026

Why Your AI's 'This Month' Number Includes Last September Too

Asked for September signups and the count is huge. EXTRACT(MONTH FROM created_at) = 9 matches every September in the table — 2024, 2025, 2026. 'This month' needs a date range, not a month number.

September 17, 2026

Why Your AI's IN List Drops Rows When One Value Is NULL

Asked for orders in a set of plan IDs from a subquery and got a thin result — or nothing. IN (1, 2, NULL) is not '1 or 2 or missing.' Any NULL in an IN list makes unknown comparisons; NOT IN with a NULL can zero the whole query.

September 17, 2026

Why Your AI's Join Returned Millions of Rows

Asked for orders with customer names and got a huge result or a timeout. The JOIN has no ON, or ON 1=1, or a comma-style FROM a, b. That's a Cartesian product — every order times every customer.

September 17, 2026

Why Your AI's Join Returns the Wrong ID

Asked for orders with customer names and the id column is the customer id — or both tables' ids mashed together. SELECT * after a JOIN produces two columns named id. The model often picks the wrong one for a follow-up filter.

September 14, 2026

Why Your AI's JSON Filter Misses Rows That Are Clearly There

Asked for events where payload.plan is pro and got nothing. -> returns JSON (with quotes); ->> returns text. Comparing JSON '"pro"' to text 'pro' does not match. MySQL and SQL Server have their own JSON extract functions with the same trap.

September 14, 2026

Why Your AI's Status Filter Misses Rows With a Hidden Space

Asked for status = 'active' and some obviously active rows didn't show. The stored value is 'active ' — a trailing space. Equality does not trim. Forms, CSVs, and CHAR columns do this constantly.

September 14, 2026

Why Your AI's Conversion Rate Query Dies on One Empty Group

The percentage query worked until one plan had zero trials. Then Postgres or SQL Server errored, or MySQL returned NULL. Division by COUNT when a group is empty is not a rounding bug — the denominator is zero.

September 12, 2026

Why Your AI's 'Customers With More Than 3 Orders' Includes Everyone

Asked for customers with more than three orders and the list is huge — or the query errors. WHERE runs before GROUP BY. A count-per-group filter belongs in HAVING, not WHERE. Same words, different clause, different result.

September 12, 2026