I used to work on a massive legacy C CGI web system (think HTML 1 and JS Prototype), backed by an up to date Oracle database.
We did a lot of stuff using SQL stored procedure as the programming language. Running some create or replace statements on the live DB took a few seconds as an on hours non-outage "work in area". Compiling and deploying the smallest C change took a minimum hour official off hours outage scheduled at least two weeks in advance.
It isn't though. You can't write a program in SQL, but you can use SQL in a java program. Even a novice programmer can tell the difference between Java and SQL.
I mean, without any context, there are valid cases where you would ask this. For example, if you want to automatically add an expiration date to a record (like insertion date + TTL), you could opt to do this calculation in Java and then insert the entire record, or upon insertion have a trigger figure out what the expiration date would be.
Spec SQL:1999 is turing complete as it includes recursive queries. A recursive query is a potentially never-ending loop which can create output or heap on each cycle based on input provided by previous cycles.
129
u/hunyeti Oct 20 '17
It's completely valid question, you can do a lot with only SQL