52

I know enough about SQL to get my job done but reading different articles I see T-SQL, SQL Server and SQL. Are they all the same? What are the major differences between the three?

I know SQL is an ANSI standard. What about the other two?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
DenaliHardtail
  • 27,362
  • 56
  • 154
  • 233
  • 2
    TSQL is a flavor of SQL developed by microsoft that is used for their DB product - MS SQL Server. TSQL has its own extensions (just like any other db vendor) other than the basic SQL. I am not sure whether it supports the ANSI SQL standard completely, though. – shahkalpesh Aug 19 '09 at 16:18
  • 3
    Nothing supports the ANSI SQL Standard completely. – John Saunders Aug 19 '09 at 16:20
  • 3
    Actually - T-SQL / Transact-SQL was developed by Sybase for their database server, which Microsoft then licensed. – marc_s Aug 19 '09 at 16:21
  • **WHICH** ANSI standard?? There are so many..... and you can support them to a varying degree........ "standards" (in plural) ought to be outlawed! – marc_s Aug 19 '09 at 16:22

5 Answers5

98

SQL is the basic ANSI standard for accessing data in a relational database. When you see "MSSQL" it is referring to Microsoft SQL Server, which is the entire database architecture and not a language. T-SQL is the proprietary form of SQL used by Microsoft SQL Server. It includes special functions like cast, convert, date(), etc. that are not part of the ANSI standard.

You will also see things like plSQL, which is Oracle's version of SQL, and there are others as well (mySQL has its own version, for example, and Microsoft Access uses Jet SQL.)

It is important to note the the ANSI standard for SQL has different releases (for example, 92 or 99, representing the year it was released.). Different database engines will advertise themselves as "mostly ANSI-92" compliant or "fully ANSI-99" compliant, etc, and any exceptions will usually be documented.

So although "SQL is SQL", every engine uses its own "flavor" of it, and you do have to do a little reading on the particular platform before you just dive in.

A further note - the SQL extensions, like T-SQL, are generally considered full-fledged programming languages, complete with looping, if/then, case statements, etc. SQL itself is limited to simply querying and updating data and is not considered a true programming language.

Wikipedia has a decent article for an overview here: http://en.wikipedia.org/wiki/SQL

user158017
  • 2,891
  • 30
  • 37
  • 3
    Very well written clarification. Thank you! – Matt P Jul 09 '14 at 03:44
  • 2
    PL/SQL (not plSQL) is an in-database programming language, not a "version of SQL" (or even a query language). I'd edit this answer but the question's closed anyway. – William Robertson Jan 23 '18 at 17:59
  • So, is it more like ANSI SQL is the base and T-SQL, Oracle's SQL, etc., add features on top the ANSI SQL? Like JS and jquery, React, etc? – Amateur_coder Dec 12 '21 at 17:04
15

It depends in what context those terms are being used.

They might mean exactly the same or have a slightly different meaning in some situations.

  • T-SQL - dialect of SQL language used in Microsoft Sql Server
  • MSSQL - Microsoft SQL Server software
  • SQL - Structured Query Language - depending on the context it might mean the sql language itself, sql database or sql database server of any kind.
Michał Piaskowski
  • 3,800
  • 2
  • 34
  • 46
8

T-SQL is shorthand for Transact-SQL, which is Microsoft's SQL dialect, whereas MSSQL usually refers to the SQL Server engine itself.

Ben M
  • 22,262
  • 3
  • 67
  • 71
  • 4
    Actually - T-SQL / Transact-SQL was developed by Sybase for their database server, which Microsoft then licensed. – marc_s Aug 19 '09 at 16:36
  • 9
    And Iraq used to be part of the Ottoman Empire. Yet we don't hear that when discussing the recent war... which always really bugs me! – Ben M Aug 19 '09 at 16:38
7

1.SQL is a programming language while T-SQL is an extension to SQL.

2.T-SQL is proprietary while SQL is an open format.

3.T-SQL contains procedural programming, local variable, and such while SQL does not.

4.T-SQL is Turing complete while SQL is not.

5.T-SQL has a different implementation of DELETE and UPDATE than SQL.

6.T-SQL is best if you use Microsoft SQL servers

6

Unlike the Ottaman empire, Sybase still exists, and still uses Transact SQL. The Sybase (ASE) implementation is not exactly the same as the Microsoft one.

Sybase TSQL Guide

david25272
  • 976
  • 6
  • 12