If the column value is mandatory for a row, you define the column as being NOT NULL. Otherwise, the column is allowed to contain the NULL value, which represents no value. The default is to allow NULL values, but you should explicitly declare columns NOT NULL unless there is a good reason to allow NULL values.
The sample database has a table called Departments, which has columns named DepartmentID, DepartmentName, and DepartmentHeadID. Its definition is as follows:
Column | Data type | Size | NULL/NOT NULL | Constraint |
---|---|---|---|---|
DepartmentID | integer | — | NOT NULL | Primary key |
DepartmentName | char | 40 | NOT NULL | None |
DepartmentHeadID | integer | — | NULL | Foreign key |
If you specify NOT NULL, a column value must be supplied for every row in the table.
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |