Nulls Indicate Absence of Value (162)
A null is the absence of a value in a column of a row. Nulls indicate missing,
unknown, or inapplicable data. A null should not be used to imply any other value,
such as zero. A column allows nulls unless a NOT NULL or PRIMARY KEY integrity
constraint has been defined for the column, in which case no row can be inserted
without a value for that column.
Nulls are stored in the database if they fall between columns with data values. In these
cases they require 1 byte to store the length of the column (zero).
Trailing nulls in a row require no storage because a new row header signals that the
remaining columns in the previous row are null. For example, if the last three columns
of a table are null, no information is stored for those columns. In tables with many
columns, the columns more likely to contain nulls should be defined last to conserve
disk space.
Most comparisons between nulls and other values are by definition neither true nor
false, but unknown. To identify nulls in SQL, use the IS NULL predicate. Use the SQL
function NVL to convert nulls to non-null values.
Nulls are not indexed, except when the cluster key column value is null or the index is
a bitmap index.
空值
1. 空值表示一行的某列無值 . 空值的含義是資料缺失 , 未知 ,或N/A .空值不等同於其他任何值,如0 .
2. 當一個空值在一行中位於有資料值的兩列之間時 , 此列在資料庫中需要佔用 1 位元組的空間來儲存其列長(0).
3. 而當一個空值位於行尾時無需佔用儲存空間 , 因為新一行的行頭就標誌著前一行未儲存的欄位均為空 .
4. Oracle 中規定空值和其他任何值的比較結果既非真也非假 , 而是未知 . 如需在 SQL 中判斷空值 , 應該使用謂詞IS NULL .
使用者可以使用 SQL 函式 NVL 將空值轉換為非空值.
5. 空值不會被加入索引 , 但有兩種情況例外:其一是為空值的列屬於簇鍵,其二是索引為點陣圖索引
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10599713/viewspace-981253/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- json_strip_nullsJSONNull
- LeetCode 162 JavascriptLeetCodeJavaScript
- 報錯“Please indicate a valid Swagger or OpenAPI version field”SwaggerAPI
- 162、黃鶴樓
- 162. Find Peak Element
- 162. 尋找峰值
- LeetCode-162-尋找峰值LeetCode
- PostgreSQL DBA(162) - Extension(pg_catcheck)SQL
- golang multiple-value xxx in single-value contextGolangContext
- [20231103]sqlplus column new_value old_value.txtSQL
- [20230303]sqlplus column new_value old_value.txtSQL
- JavaScript select valueJavaScript
- @ConfigurationProperties和@Value
- Educational Codeforces Round 162 (Rated for Div. 2) - VP記錄
- Oracle分析函式-first_value()和last_value()Oracle函式AST
- 每週一書:162頁《笨辦法學 Python》分享!Python
- 【手摸手玩轉 OceanBase 162】發起資料備份
- 7.94 FIRST_VALUE
- 7.92 FEATURE_VALUE
- 7.12 ANY_VALUE
- WPF ProgressBar show value
- RESTOREkeyttlserialized-value[REPLACE]RESTTLSZed
- 為什麼Math.abs(Integr.MIN_VALUE)==Integer.MIN_VALUE
- python: invalid value encountered in divide以及invalid value encountered in double_scalars報錯PythonIDE
- tf.clip_by_value() 用法
- solidity的msg.valueSolid
- Harmonic Value Description HDU - 5916
- @Value失效的問題
- Smart Value Help 總結
- 如何拿到註解@ApiModelProperty(value = “單位名稱“, name = “orgName“)中的value值;API
- Syntax error, unrecognized expression: li[value=]ErrorZedExpress
- attempt to index local ‘result‘ (a nil value)Index
- Transmit Value by Customized Annotation in AOP InterceptionMITZed
- mybatis竟然報"Invalid value for getInt()"MyBatis
- 科技愛好者週刊(第 162 期):生活就像《吃豆人》遊戲遊戲
- textarea中的innerHtml,innerText和valueHTML
- 513-Find Bottom Left Tree Value
- JavaScript獲取選中checkbox valueJavaScript
- [20180808]Null value to Dynamic SQL.txtNullSQL