In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the case study of T-SQL, which has certain reference value and can be used for reference by friends who need it. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.
Transact-SQL is usually abbreviated to T-SQL, or TSQL, which is a proprietary extension of SQL to Microsoft and Sybase. Transact-SQL extends the SQL standard to include additional features that are not included in the SQL standard.
Here is an example of a simple T-SQL statement:
CREATE DATABASE Movies
This is a simple example of T-SQL. This creates a new database called Movies.
However, T-SQL provides other options included in this statement, such as where the database files should be, the size of these files, what their maximum size should be, and so on.
Some of the features of T-SQL include:
1. Programming
2. Local variables
3. Support string processing, data processing, mathematics and other functions
4. Changes to DELETE and UPDATE statements. In particular, they allow you to add a FROM clause, which allows you to include joins.
5. T-SQL has a BULK INSERT batch insert statement that allows you to import data files into database tables or views in a user-specified format.
One of the main benefits of the above extension is that you have more programmability when using T-SQL and SQL. For example, stored procedures allow you to merge programming logic into a database. You can pass one or more parameters to the stored procedure, which will return an output that varies according to the value of the parameter.
T-SQL also includes a number of built-in functions, as well as support for user-defined functions.
An example of a built-in function
Here is another basic example, this time using one of T-SQL 's built-in functions:
SELECT GETDATE ()
Output:
2018-05-06 23 Suzhou 3030 37.003
In this case, we use the GETDATE () function of T-SQL to return the current date and time. This is used in conjunction with the SELECT statement, which is a common SQL statement that returns data.
We can also use this function as an argument to another function. Here's an example:
SELECT FORMAT (GETDATE (), 'MMM')
Results:
May
History of T-SQL
Although Transact-SQL (and SQL Server) is best known as Microsoft, it is actually the result of a collaboration between Microsoft and Sybase in 1987. The partnership was dissolved in 1994.
Since then, T-SQL has continued to be supported by database products released by the two companies, but each company has developed its own database products in its own direction. Therefore, there are some differences between Sybase T-SQL and Microsoft T-SQL.
T-SQL and GUI tools
Transact-SQL is the core of SQL Server. Most of the operations in SQL Server are done using T-SQL. This is true even if you use GUI tools such as SSMS or DBeaver without actually doing any programming. Whenever an application is used to interact with SQL Server, the application uses T-SQL to perform specified tasks in the background.
But SQL Server is not the only database management system that supports Transact-SQL. The Microsoft Azure SQL database also supports T-SQL. Most of the T-SQL features used by applications are fully supported in Microsoft SQL Server and Azure SQL databases (although there are some exceptions).
About the GO command
Anyone who has used T-SQL is probably familiar with the GO command. This keyword is usually placed at the end of a batch of statements. For example, the first example above could also be written as follows:
CREATE DATABASE Movies
GO
However, the GO command is not actually part of Transact-SQL. In fact, the GO command cannot even occupy the same line of the Transact-SQL statement.
GO is one of the commands recognized by the sqlcmd and osql utilities and the SQL Server Management Studio code editor that promote the readability and execution of batches and scripts. The GO command sends the end signal of a batch of Transact-SQL statements to the SQL Server utility.
The SQL Server utility interprets GO as a signal that they should send the current batch of Transact-SQL statements to an instance of SQL Server. The current batch of statements consists of all statements entered since the last operation, or, if this is the first time, all statements entered since the start of a special session or script.
Other proprietary SQL extensions
Transact-SQL is not the only extension of the SQL standard. Various database systems have their own extensions. For example, Oracle uses a proprietary process language, PL/SQL, and PostgreSQL uses a process language, PL/pgSQL.
Although proprietary SQL extensions have their advantages (such as extension capabilities), they also have disadvantages. A major disadvantage is that if you need to migrate databases from one system to another, they can make things difficult. For example, if your organization suddenly decides to use Oracle instead of SQL Server, you may need to traverse all the SQL Server code and rewrite it for Oracle. This also requires you to be familiar with the syntax of these two systems.
Thank you for reading this article carefully. I hope it will be helpful for everyone to share the case study of T-SQL. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.