Skip to main content
9 events
when toggle format what by license comment
Jun 10, 2015 at 21:01 vote accept Sridhar Sarnobat
Jun 10, 2015 at 19:57 comment added Ixrec To be fair, the OP did phrase the question as "are SQL queries equivalent to higher-order functions", not "is the SQL language equivalent to a functional programming language", so neither answer is wrong.
Jun 10, 2015 at 18:57 vote accept Sridhar Sarnobat
Jun 10, 2015 at 18:57
Jun 10, 2015 at 18:54 comment added Sridhar Sarnobat Maybe I didn't phrase the question formally enough. I guess I don't need it to be bidirectionally equivalent in 100% of cases. Just that the typical queries through one approach can be rewritten as another.
Jun 10, 2015 at 18:52 comment added Sridhar Sarnobat I like this answer for different reasons to the other answer that talks about relational algebra. Ideally I'd mark both as correct.
Jun 10, 2015 at 18:23 comment added Bart van Ingen Schenau For a semantic equivalence, I would expect that you can show it in both directions. Both that SQL queries can be expressed in higher-order functions and that you can express a higher-order function in SQL syntax.
Jun 10, 2015 at 18:17 comment added Mason Wheeler @Bart: Then question was "is there a sound semantic equivalence that can be proven?" Implementing one thing in terms of another is a time-honored technique for proving equivalence in computer science. For example, one way to prove that a language is Turing-complete by using it to implement another language that is already known to be Turing-complete.
Jun 10, 2015 at 18:16 comment added Bart van Ingen Schenau This only demonstrates that higher-order functions can be used to realize SQL operations, not that the two are related to each other in general.
Jun 10, 2015 at 18:10 history answered Mason Wheeler CC BY-SA 3.0