SQL vs T-SQL
Query languages are used for accessing and manipulating databases. SQL and T-SQL are two of the popular query languages used today. Structured Query Language (SQL) is a computer language for databases. It is used for accessing and manipulating data in Relational Database Management Systems (RDMS). T-SQL (Transact SQL) is an extension of SQL developed by Microsoft. T-SQL is the query language used in Microsoft SQL Server.
SQL has the capabilities to insert data in to a database, query data for information, update/ delete data in a database and create/modify the database schema. SQL was developed by IBM in early 1970s and was initially called SEQUEL (Structured English Query Language). SQL language has several language elements called clauses, expressions, predicates, queries and statements. Among these, most widely used are the queries. Queries are defined by the user in such a way that he/she describes the desired properties of the subset of data that he/she needs to retrieve from the database. Then the Database Management System performs the necessary optimization to the query and executes the necessary physical operations to produce the results of the query. SQL also allows data types such as character strings, bit strings, numbers and date and time to be included in columns of the databases. American National Standard Institute (ANSI) and International Organization for Standardization (ISO) adopted SQL as a standard in 1986 and 1987 respectively. Even though SQL is an ANSI standard, there are many different versions of the SQL language. But to comply with the ANSI standard all of these versions support the widely used commands such as SELECT, UPDATE, DELETE, INSERT, WHERE in a similar manner.
T-SQL is an extension of SQL developed by Microsoft. T-SQL extends SQL by adding several features such as procedural programming, local variables and supporting functions for string/ data processing. These features makes T-SQL Turing complete. Any application, which needs to communicate with Microsoft SQL server, needs to send a T-SQL statement to the server. T-SQL provides flow control capabilities using the following keywords: BEGIN and END, BREAK, CONTINUE, GOTO, IF and ELSE, RETURN, WAITFOR, and WHILE. Furthermore, T-SQL allows a FROM clause to be added to DELETE and UPDATE statements. This FROM clause would allow inserting joins in to DELETE and UPDATE statements. T-SQL also allows inserting multiples rows in to a table using the BULK INSERT statement. This would insert multiple rows in to a table by reading an external file containing data. Using BULK INSERT improves performance than using separate INSERT statements for each row that needs to be inserted.
What is the difference between SQL and T-SQL?
SQL is a computer language for databases that has the capabilities to insert data in to a database, query data for information, update/ delete data in a database and create/ modify database schema, while T-SQL extends SQL by adding several features. T-SQL is developed by Microsoft and it is mainly used in Microsoft SQL server. These features include procedural programming, local variables and supporting functions for string/ data processing. T-SQL also allows inserting multiples rows in to a table using the BULK INSERT statement, which is not available in SQL. Furthermore, T-SQL allows to include a FROM clause in to DELETE and UPDATE statements.