dataminor avatar image
dataminor asked

Is tSQL a 'Turing Complete' programming language?

I recently applied at a university to do a post graduate course in Data Science. When you go through this process the university helpfully assigns someone to your application to guide you through it. Many years ago I did an undergraduate arts degree in Statistics and, long story short, that led me into working with data, and ultimately databases. Anyway, the degree (being ...Arts ...ewwww) was so long ago that the university said it wouldn't contribute much to my application. In cases like this, they look at relevant work experience. I have 10+ years in data analysis, ETL and so on. One of the questions on the application form was "Have you worked closely with a programming language for at least the past five years?" I answered "Yes - t-SQL". So I got a phone call from the "assistant" who informed me that my application had been declined because "t-sql is **not a real programming language**." He said "We're looking for something like Java or C++ or Python." Now apart from snobbery, in what sense is t-SQL not a "real" programming language? I was under the impression that the measure of whether something is a real programming language or not, is its "Turing Completeness". t-SQL has branching and looping (if you really want it) and so on. Granted it does some things less efficiently than other languages, but that doesn't preclude it from being a "real programming language". Turing Completeness has nothing to do with efficiency. Is Turing Completeness the decider of what is or is not a "real programming language"?
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Scot Hauder avatar image
Scot Hauder answered
Yes, it is Turing complete. T-SQL is declarative--but also--an imperative language. Sorry to hear about the rejection but I see it as a win, you don't want to be part of that organization or give them any of your money. In the real world I would hire you for your T-SQL xp over any Java developer. EDIT: For perspective,I am a DBA/(I guess they call it data scientist now) with my days filled mostly working with T-SQL, PowerShell, F#, Matlab/R and in a former life worked with C, assembly, C#,VB and was a Web developer for several years. What I have learned over this time, and especially recently, is that you can write sloppy C# / web code and it will still run fast but the expertise to optimize a query, stored proc, db schema and indexing are the most valuable skills. Unfortunately many IT managers do not understand this. As an aside, I find it amusing,albeit disturbing, that all of the YouTube videos enumerating the "Top 10 programming languages you need to learn" never include SQL.
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

GPO avatar image GPO commented ·
Phil Factor tells the story of the time he went in a coding competition. The objective was to optimise the code for an application to make it run faster. He won it, he says, not because of the changes he made to the application's data management, but simply because he added an appropriate covering index to the underlying database. But who needs to understand databases to study data science, right?
1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.