logoalt Hacker News

TomasBMyesterday at 8:17 PM6 repliesview on HN

Somewhat tangential to the article, but why is SQL considered a programming language?

I understand that's the convention according to the IEEE and Wikipedia [1], but the name itself - Structured Query Language - reveals that its purpose is limited by design. It's a computer language [2] for sure, but why programming?

[1] https://en.wikipedia.org/wiki/List_of_programming_languages

[2] https://en.wikipedia.org/wiki/Computer_language


Replies

derrizyesterday at 9:02 PM

With support for Common Table Expressions (CTE), SQL becomes a Turing complete language. To be honest, it makes me somewhat uncomfortable that a query sent to a DB server could be non-terminating and cause a server thread to enter an infinite loop. On the other hand, the practical difference between a query that contains an infinite loop and one that runs for days is probably negligible.

Imustaskforhelpyesterday at 8:24 PM

To be honest, I'd like to chip in that it is technically possible to write brainf*ck, an esoteric programming language but nonetheless, its a programming language

https://www.reddit.com/r/SQL/comments/81barp/i_implemented_a...

Btw this runs in sqlite, you can try it yourself if you are interested.

Source: I was thinking of creating a programming language paradigm like sqlite/smalltalk once where resumed execution/criu like possibilities were built in. Let me know if someone knows something like this too. I kinda gave up on the project but I knew that there was this one language which supported this paradigm but it was very complicated to understand and had a lot of other first time paradigm like the code itself / the ast tree is sort of like a database itself but so the tangential goes.

yawaraminyesterday at 8:28 PM

What is your definition of 'programming language'?

show 1 reply
pjmlpyesterday at 8:20 PM

Because stored procedures do exist, and there isn't a single production quality RDMS that doesn't go beyond DDL and DML, adding structured programming extensions.

Also, even within the standard itself, it allows for declarative programming.

randomNumber7yesterday at 9:48 PM

Also SQL is not turing complete. I see it more as a descriptive language like e.g. html is a language but not a programming language.

show 2 replies
rawgabbityesterday at 8:23 PM

Because "programming language" is an adjective or a descriptive term. Whatever looks like a programming language, can be called a programming language.