Create and delete constraint constraint type PRIMARY KEY constraints using SQL statements (Primary key constraint)--: Requires primary key column data to be unique and is not allowed to be empty. Unique constraint (UNIQUE constraint)--: Requires the column to be unique, allowed to be empty, but only one null value can occur. CHECK constraints (CHECK constraint)---A column value range limit, formatting restrictions, and so on, such as The age, mailbox (must have @) constraints. Default constraint--: The default value of a column, such as a database where there is a lot of duplication of data, can be set to the default value. FOREIGN KEY constraint (Foreign key constraint)--: For establishing a relationship between two tables, you need to specify which column of the primary table is referenced. Add constraint: ALTER TABLE TABLENAMEADD constraint Pk_ ColName primary KEY (colname) main constraint ALTER TABLE TABLENAMEADD constraint uq_colname unique (colname) UNIQUE constraint ALTER TABLE Tablenameadd constraint Df_colname default (' Address Unknown ') for colname defaults constraint ALTER TABLE TABLENAMEADD constraint ck_colname Check ( ColName between and 15) CHECK constraint ALTER TABLE TABLENAMEADD constraint fk_colname foreign key (colname) references TableName (col Name) external constraint delete constraint: ALTER TABLE TABLENAMEDROP CONSTRAINT constraint name Create login account/database user create logon account: Exec sp_grantlogin ' Windows domain name/ Domain account ' CREATE database User: Exec sp_grantdbaccess ' login account ', ' database user ' authorization to database: Grant permission [on table name]to database user above statement can be operated directly in Enterprise Manager/Security/Login/ New login fill in name and password Select Database access, and then under "Database roleAllow "db_owner also tick the default constraint enables the user to define a value that is provided to this column whenever the user does not enter a value in a column. If the user does not have a specific requirement for this column, you can use the default constraint to enter a default value for this column.