1. T-SQL condition expression:
(1). Constant: contains one or more letters, numbers, or symbols (! @ #) Composition
(2). unary operator: Only one operand operator + represents an integer-represents a negative number ~ Complement Operator
(3) binary operator: the operator that combines two operands contains the arithmetic operator value assignment operator (=) bit operator comparison operator logical operator String concatenation operator (+) or unary operator
==><=<> (Not equal )! (Not)
(4). '_': a character like 'C _ 'must contain at least two characters
%: Any length string a like 'C %'
[]: A like '[1-9]' for data within the specified range
[^]: Data not in the specified range
(5). logical operators: And or not
The in keyword is used to limit multiple returned values.
2. T-SQL insert data
Insert into Table Name (column, column, column ...) Values (Value column ,,,)
Add existing table dataNew existing tableMedium: inster into newtable new table (column) Select column from old table (this can be noted: like English: insert query data from old table to new table)
Add existing table dataThe new table does not exist.Medium: Select column into new table from old table
The preceding statement cannot be specified. Therefore, we need to create a new ID column. The syntax is as follows:
Select other columns, identity (data type, identification seed, identification growth) as column name
Into new table
Form old table
Merge data using the Union keyword for insertion
Insert table name (column name)
Select column value Union
Select column value Union
Select column value Union
Select column Value
Union is not required for the last row.
3. Update data with T-SQL
Update table name set column name = new value where Condition
4. Use T-SQL to delete data
Delete from table name where Condition