Difference between SQL, PL-SQL, and T-SQL
By Theydiffer - August 2, 2016

All three programming languages are connected to each other, but are different in more ways than one.


Standard Query Language or SQL is a programming language specifically designed for data management. An ISO and ANSI standard, SQL is supported by numerous database products and features a programming interface as well. It is now the most popular database language.

SQL was initially built on tuple relational calculus and relational algebra and consists of a data manipulation definition, and data control language. Its main functions include query, data insert, schema modification and creation, update and delete, data access control, and data insert.

Developed during the early 1970’s by Raymond Boyce and Donald Chamberlain at IBM, it was used on IBM’s database management system called System R. The acronym SEQUEL was then shortened further to SQL as a UK-based aircraft company already owned the name.

A literal mix of SQL together with procedural language PL-SQL was developed for Oracle as its very own database management system and to serve as an enhancement to the functions of SQL. Java, PL-SQL, and SQL itself form the three essential programming languages in the Oracle Database.

In PL-SQL, a block represents its basic unit which is further broken down into 3 sub-units: a declarative, an exception-building, and an executable part. Since PL-SQL allows merging SQL statements and procedural constructs, SQL statements can be grouped (using PL SQL blocks with subprograms) prior to sending it to the Oracle database. This is critical in a network environment as Oracle can process SQL statements in said groupings, and not one by one, permitting faster response times and quicker traffic flow.

T-SQL, or Transact-SQL was developed by Microsoft and Sybase as an enhancement to SQL. It’s a proprietary programming language under Microsoft’s control for managing their relational database.

Microsoft designed T-SQL to feature a local variable and programming element that offers a greater degree of control of how the application works. There are functions for string operations, date and time processing and mathematical operations, among others. Records can be easily filtered when picking out entries that match a certain search criteria. These improvements made T-SQL compliant with the Turing completeness test, which means T SQL is universal as a computing language.


So what are the differences between SQL and its derivatives PL-SQL and T-SQL?

SQL is an industry standard programming language specifically used for database management. With SQL, database objects can be created, modified, and deleted. However, it does not offer functions other normal programming language do such as IF and THEN statements, and loops.

PL-SQL is not industry standard since only Oracle uses it. It was developed as an extension to SQL, and comes with essential features SQL does not. No other programming language can be integrated with SQL other than PL-SQL. This feature has made PL-SQL a good choice for developing big, complex programs that need to connect with an Oracle database.

T-SQL was designed as an improvement to SQL and is a proprietary programming language of Microsoft. T-SQL may look similar to PL-SQL from the get go, but these two enhancements to SQL are fundamentally different. Porting PL-SQL code to T-SQL and vice versa is difficult as their feature sets are different.

Comparison chart

Industry standard, open sourceNon-industry standard, used only on Oracle databaseExclusive to Microsoft
Not Turing completeTuring completeTuring complete
Limited database managementNormal programming language functions; integrates well with SQLFeatures a greater degree of control of how the application operates