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

No, but you can write an UPDATE which uses a SELECT in all of SET, FROM, and WHERE, which broadly speaking will do the same thing.

The difficulty in figuring out all this syntactic weirdness is probably overstated for small queries, but it's there. Most attempts to write a better SQL I've seen succeed in narrow terms, but if the goal is to replace SQL rather than write a better syntax which (almost) no one uses, that's not enough.



That's what I had always assumed - i.e. if the first keyword is SELECT it can't possibly modify the data, which does match the OP's claim that SQL separates queries from data manipulation commands.


I see a small impedance mismatch between "SQL prohibits updating in queries" and "SQL requires you to write query updates a certain way", though I see where OP is coming from. One of the reasons mini/microKanren has taken off in research is the use of immutable data structures to prevent the morass you can get with self-modifying Prolog queries.


Except that all DML commands can also be queries by way of RETURNING.




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

Search: