Transact-SQL(T-SQL) : Difference from SQL and PL/SQL?
Transact-SQL(T-SQL) is an extension of SQL developed for interacting with relational databases.
T-SQL is the product of Microsoft which expands on the SQL standard to include procedural programming.
It is the Microsoft’s implementation of SQL which can be used with Microsoft SQL Server and Azure SQL Database. It furthermore includes various extra features in comparison to regular SQL which includes procedural programming, local variables, data processing, mathematics, string processing ,etc. T-SQL is a programming language to Microsoft’s SQL database like PL/SQL is to Oracle database. All the communication between the application and SQL Server takes place with Transact-SQL statements.
Now, some of the features of T-SQL are listed below:
- Increased Programmability using Procedural Programming
- String Processing, Mathematics, Date Processing, etc
- Large no of built in functions
- Provides a built-in, interpreted and OS independent programming environment
- Local Variables.
- DELETE and UPDATE statements that can be changed
- BULK INSERT Statement which allows to import directly a data file into the database.
Difference between SQL, PL/SQL and T-SQL:
SQL: Stands for Structured Query Language which is used for communicating with SQL. It is an standard language for manipulating and retrieving data in relational database .
PL/SQL : It is combination of SQL along with a block of programming language which allows the developers to combine the features of procedural programming with SQL statements . It can execute a block of statement at a time using single command. It is an extension of SQL. It is a product of Oracle.
T-SQL: Already discussed above.
Applications that generate Transact-SQL:
- Office Productivity Applications
- GUI database applications
- Business applications storing data in SQL Server
- DataWarehouse where data is extracted from Online Transaction Processing Systems(OLTP)
Creating a table:
CREATE TABLE tbl_Students ( SId int IDENTITY(1,1) NOT NULL PRIMARY KEY, StudentName nvarchar(255) NOT NULL, ActiveFrom date );
Creating a Stored Procedure in Microsoft SQL Server:
/* Getstudentname is the name of the stored procedure*/ Create PROCEDURE Getstudentname ( @studentid INT --Input parameter , Studentid of the student ) AS BEGIN SELECT Firstname+' '+Lastname FROM tbl_Students WHERE studentid=@studentid END
Also Read:Singleton Design Pattern in C#
For more detail:T-SQL Wikipidea