1. T-SQL conditional expression:
(1). Constant: composed of one or more letters, numbers or symbols (! @ #)
(2). Unary operator: The operator with only one operand + represents an integer - represents a negative number ~ represents the complement operator
(3). Binary operators: operators that combine two operands include arithmetic operators, assignment operators (=), bit operators, comparison operators, logical operators, string concatenation operators (+) or unary operators
= > < >= <= <> (not equal to) ! (not)
(4).'_': A character A LIKE 'C_' at most at least two characters
%: Any length string A LIKE 'C%'
[]: Interval data within the specified range A LIKE '[1-9]'
[^]: Data not in this interval (specified range)
(5). Logical operator: And Or Not
The In keyword is used to limit the return to multiple values.
2.T-SQL insert data
Insert into table name (column, column, column...) values (value column,,,)
Add data from an existing table to a new existing table: inster into newtable new table (column) select column from old table (it can be recorded like this: just like in English: query data from the old table and insert it into the new table)
Add data from an existing table to a new, non-existing table: select columns into new table from old table
The above statement does not allow the identity column to be specified, so we need to create a new identity column. The syntax is as follows:
select other columns, identity (data type, identification seed, identification growth amount) as column name
into new table
form old table
Merge data through Union keyword for insertion
insert table name (column name)
select column value union
select column value union
select column value union
select column value
There is no need for union in the last line
3. Use T-SQL to update data
update table name set column name = new value where condition
4. Use T-SQL to delete data
delete from table name where condition