4.2.11. Scalar Subqueries
4.2.11. Scalar Subqueries
4.2.11.標量子查詢
A scalar subquery is an ordinary SELECT query in parentheses that returns exactly one row with one column. (See Chapter 7 for information about writing queries.) The SELECT query is executed and the single returned value is used in the surrounding value expression. It is an error to use a query that returns more than one row or more than one column as a scalar subquery. (But if, during a particular execution, the subquery returns no rows, there is no error; the scalar result is taken to be null.) The subquery can refer to variables from the surrounding query, which will act as constants during any one evaluation of the subquery. See also Section 9.22 for other expressions involving subqueries.
標量子查詢是一個在括號中,僅返回一列一行的普通SELECT查詢。(有關如何寫查詢語句,請參見第7章。)執行select查詢,然後返回的單個值由外層表示式使用。在標量子查詢中,返回大於一行或多於一列,會返回錯誤。(但是,如果在特定查詢中,子查詢未返回行,則不會報錯;此處標量結果為null。)子查詢可引用外層查詢的變數,該變數會在子查詢的每次執行中作為常量使用。對於子查詢中其他表示式,請參見9.23節。
For example, the following finds the largest city population in each state:
例如,如下查詢返回每個州人口最多的城市:
SELECT name, (SELECT max(pop) FROM cities WHERE cities.state =
states.name)
FROM states;
相關文章
- TypeError: only integer scalar arrays can be converted to a scalar indexErrorIndex
- F. Scalar Queries
- [記錄]RuntimeWarning: overflow encountered in scalar subtract
- .NET9 - Swagger平替Scalar詳解(四)Swagger
- 張量(Tensor)、標量(scalar)、向量(vector)、矩陣(matrix)矩陣
- OpenCV學習筆記(3)——Scalar資料型別理解OpenCV筆記資料型別
- Oracle 20c 新特性:SQL 巨集支援(SQL Macro)Scalar 和 Table 模式OracleSQLMac模式
- MySQL 8.0 Reference Manual(讀書筆記52節--Optimizing Subqueries, Derived Tables, View References, and Common Table Expressions(2))MySql筆記ViewExpress
- MySQL 8.0 Reference Manual(讀書筆記51節--Optimizing Subqueries, Derived Tables, View References, and Common Table Expressions(1))MySql筆記ViewExpress
- 標量碼與向量碼(Scalar code & Vector code)及一些後續知識
- 育碧公佈雲原生技術Ubisoft Scalar 創新突破改變遊戲開發和體驗方式遊戲開發