3 ms·
“Thinking in sql” is hard because it’s an awkward syntax for the (much simpler) relational algebra. Learn to think in terms of the relational algebra, and how
by danielheath 2y ago
“Thinking in sql” is hard because it’s an awkward syntax for the (much simpler) relational algebra.
Learn to think in terms of the relational algebra, and how to translate that to/from SQL, and it starts making sense.
- jitl 2y agoI can express my ideas well enough in various Datalog/Prolog variants w/ the horn syntax. But when it comes to translating that from several discrete simple propositions into one massive CTE-stack SQL query I get very puzzled. I wrote a toy Datalog-to-SQLite compiler (https://percival.jake.tl https://percival.jake.tl) but I struggle to grasp the translation skill myself
- refset 2y agoIt doesn't help that SQL's recursive CTE model is a bit odd - Frank McSherry proposed a much nicer alternative (which Materialize has implemented): https://materialize.com/blog/recursion-in-materialize/ https://materialize.com/blog/recursion-in-materialize/
- cryptonector 2y agoI don't find that the syntax gets in the way of thinking in relational algebra, but I did learn SQL first.