Home >Database >Mysql Tutorial >What is T-SQL
T-SQL (Transact-SQL) is a set of programming extensions from Sybase and Microsoft that add several features to Structured Query Language (SQL), including transaction control, exception and error handling, Line processing and declared variables.
Related mysql video tutorial recommendations: "mysql tutorial"
All applications that communicate with SQL Server are implemented by sending T-SQL statements to the server . T-SQL queries include SELECT statements, selecting columns, marking output columns, limiting rows and modifying search conditions.
Also, T-SQL identifiers are used for all database, server and database objects in SQL Server. These include tables, constraints, stored procedures, views, columns and data types. Each T-SQL identifier must have a unique name, assigned when the object is created, and used to identify the object.
T-SQL statement examples
The most popular T-SQL statement is a stored procedure, which is a compiled and stored T-SQL code. Similar to views, stored procedures generate an execution plan the first time they are called. The difference is that stored procedures can select data and execute any T-SQL code within any parameters.
User-defined functions are another example of a T-SQL statement. User-defined functions accept input parameters, perform operations and return results to the call.
Another example is a trigger, which is a stored T-SQL script that runs when a statement other than a SELECT is issued against a table or view. Two common triggers are the AFTER trigger and the INSTEAD OF trigger.
Programming T-SQL statements enables IT professionals to build applications included in SQL Server. These applications - or objects - can insert, update, delete or read data stored in the database.
Common Language Runtime (CLR) integration is the ultimate T-SQL statement example. Since SQL Server 2005, IT professionals can work with. NET Framework CLR integration. This allows you to use it in SQL Server objects. NET programming language to create stored procedures, user-defined functions and triggers.
T-SQL functions
In addition to the built-in functions of SQL Server, users can also use T-SQL to define functions.
Types of T-SQL functions include aggregate functions, which operate on a set of values but return a summary value; ranking functions, which return the ranking value of each row in a partition; rowset functions, which return a value that can be used in SQL Objects used as table references in statements; and scalar functions, which operate on and return a single value.
SQL Server also supports analysis functions in T-SQL to describe complex analysis tasks. These analytical capabilities enable IT professionals to perform common analyses, such as rankings, percentiles, moving averages, and cumulative sums, expressed in a single SQL statement.
The above is the detailed content of What is T-SQL. For more information, please follow other related articles on the PHP Chinese website!