5 ms·
The brilliance of RDBMSs is the relational algebra. But, I agree SQL can sometimes feel a little verbose / obtuse. I’ve had learning datalog on my todo list fo
by peatmoss 8y ago
The brilliance of RDBMSs is the relational algebra. But, I agree SQL can sometimes feel a little verbose / obtuse.
I’ve had learning datalog on my todo list for a long time. I’d love to see some other DSls for the relational algebra as well
- contingencies 8y agoRe: Verbose/obtuse. There are different ways to use SQL. For example IMHO if you use the unnecessary "<LEFT/RIGHT> JOIN" syntax then statements often come across as pretty unreadable, whereas you can generally achieve the same with alternate and more readable syntax.
- tfehring 8y agoAs opposed to SELECT * FROM a, b WHERE a.id = b.id? Looks ok on paper, but in exchange for brevity you end up demolishing your readability on complex queries, since you can’t easily identify filters (as opposed to join conditions). Most style guides, including my team’s, consider explicit JOINs mandatory, and there’s a good reason for doing so. Admittedly my work is very heavy on data manipulation; maybe complex queries are less of a concern for other use cases.
- contingencies 8y agoyou can’t easily identify filters I'm not often SQL wrangling these days, so you are probably more aware than I am on intricacies, but often you can wrap subqueries like: SELECT stuff FROM tables WHERE conditions AND table.field IN ( SELECT othertable.otherfield FROM othertables WHERE more_conditions...) ); IMHO this reads far more easily and both depth and order of execution are clear. I guess at this point in my career (20 years in) my bias is toward code I can walk away from for years and come back to easily. Clarity is better than cleverness. - Eric S. Raymond, The Art of Unix Programming (2003) He's got a point. Quote via http://github.com/globalcitizen/taoup http://github.com/globalcitizen/taoup