News for hackers. Stuff that matters.
Re:Getting AI to write good SQL by emmelaich on Friday May 16, 2025 @10:24PM (#44011577)
I'd like there to be a function or macro for a bunch of joins, say

    DEFINE products_by_order AS orders o JOIN order_items oi ON o.order_id = oi.order_id JOIN products p ON oi.product_id = p.product_id
You could make it visible to the DB rather than just a macro so it could optimise it by caching etc. Sort of like a view but on demand.
Re:Getting AI to write good SQL by icedchai on Friday May 16, 2025 @11:32PM (#44011833)
Sounds like a CTE?