In the process of using a database, the most contact is the table in the database. The table is where the data is stored. Is the most important part of the database, the management table also manages the database well. This chapter describes how to create and manage database tables.
Tables are made up of rows and columns. The process of creating a table is primarily the process of defining a table's columns, so you should first understand the properties of the table's columns.
Properties of 7.1.1 Columns
The table's column name is unique in the same table, and the data for the same column belongs to the same data type. In addition to specifying the properties of a column with column names and data types, you can define additional properties: null or NOT NULL, and identity properties.
(1) null or NOT NULL
If a column of a table is specified to have a null property, the value of the column is allowed to be omitted when the data is inserted. Conversely, if a column of a table is specified to have a not NULL property, it is not allowed to insert data rows that omit the column value without specifying a column default value. In SQL Server, the lack of a column is not NULL. To set the default property to NULL or NOT NULL, you can modify "ANSI NULL default" in the Database property options in Enterprise Manager as true or false. You can also use the following two kinds of statements to set:
Set ansi_null_dflt_on or set ansi_null_dflt_off; sp_dboption database_name, ' ANSI null default ', True/false. (2) IDENTITY
The IDENTITY property enables the columns of the table to contain the numbers that are automatically generated by the system. This number can uniquely identify each row of a table in a table, where each row of data in the table has a different number on the column specified as the IDENTITY property. The column that specifies the identity property is called an identity column. When you define a column with the IDENTITY property, you can specify an initial value and an increment. When inserting data into a table that contains an identity column, the initial value is used when inserting the first row of data, and the new identity value is subsequently obtained by SQL Server based on the identity value used last time. If you do not specify an initial value and an increment value, the default value is 1.