- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 224字
- 2021-06-24 14:38:08
Building blocks of a T-SQL statement
When writing a T-SQL statement, the following three actions are required:
- Express the intended operation, such as reading or changing data
- Provide a target or source list of affected tables
- Provide a condition that filters the affected records
The intended operation is determined by the presence of the following clauses:
- The SELECT clause lists columns or expressions that will be displayed in the result set
- The DELETE, INSERT, or UPDATE clauses state the target table or view for these logical operations
As for the affected tables and filters, they are determined by the following clauses:
- The FROM clause lists the source tables, views and/or sub-queries that contain the data to be queried
- The WHERE clause states one or more conditions that will serve to filter the result set to the desired rows
The preceding clauses determine which data will be manipulated. The formatting of the results can be further modified by adding any of the following parts:
- The ORDER BY clause defines the order in which the rows will be returned
- The GROUP BY clause aggregates rows together based on the criteria provided (typically combined with aggregate functions in the SELECT clause)
- The HAVING clause applies a predicate to the results (different than the WHERE clause, which applies a predicate to the source rows)
推薦閱讀
- Div+CSS 3.0網頁布局案例精粹
- JavaScript實例自學手冊
- 高性能混合信號ARM:ADuC7xxx原理與應用開發
- Managing Mission:Critical Domains and DNS
- 輕松學PHP
- Learning Apache Cassandra(Second Edition)
- Hands-On Cybersecurity with Blockchain
- Creo Parametric 1.0中文版從入門到精通
- 永磁同步電動機變頻調速系統及其控制(第2版)
- Excel 2007技巧大全
- 單片機技能與實訓
- Mastering Geospatial Analysis with Python
- 企業級Web開發實戰
- 項目實踐精解:C#核心技術應用開發
- ARM體系結構與編程