Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Try it with a query that has 40 joins with multiple joins to the same table from different places, and let me know if you still think it's easy :)

At work I've seen SQL queries that are thousands of lines long that would make that 40-join query look like a toy example.



That's what I always tell people advocating for plastic straws. They think plastic straws are great, they drink their cocktails with them and everything.

Then I tell them how when I try to wash my cars by assembling 50 straws into a water hose, the whole plastic straw concept quickly breaks down.

In my opinion you should never use plastic straws.


Best not to have a single query, but to break it down into a number of separate views and join those views for your final query.


That's exactly what I do and why aliases exist.

It's manual effort, but that's documentation always.


I mean, they're also talking about using the same table multiple times - aliases aren't just useful, they're required in that case so the engine knows which one you mean when using a column from one of them.

Best guess without actually seeing these queries, whoever wrote them is using bad aliases (like "foo1", "foo2" and so on) instead of something more reasonable.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: