Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is SQL really a programming language after all?

Tags:

sql

mysql

I'm presenting a portfolio of the languages I've mastered, but here's a thing I shouldn't be asking really; is SQL a literal programming language or is it not? A lot of people say it is definitely one, others completely disagree.


1 Answers

SQL is considered to be a Fourth Generation computer language. The first three are basically:

  1. Machine code.
  2. Assembly code.
  3. Common general-purpose languages, such as C, C++, Java, Python, and so on.

So, based on a commonly used definition in computer science it is a programming language. And SQL is a prime example of an entire class of languages (and perhaps the most widely used of that class).

A related question is whether SQL is Turing-complete -- that is can SQL emulate a Turing Machine. I should emphasize that this is really a theoretical question: no finite machine is really Turing complete.

I actually never studied this in depth, but I have read that the original SQL was Turing Incomplete. Only the addition of recursive CTEs makes it complete (well, I guess recursive user-defined functions might also serve this purpose).

like image 140
Gordon Linoff Avatar answered Apr 11 '26 05:04

Gordon Linoff



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!