1. Simple query
1.1 Querying all columns
Example:select * from T_userinfo
1.2 Query Development columns
Example:select * from Username,password to T_userinfo
1.3 Querying for columns with calculations
Example:select age*15 from T_userinfo
2. Conditional query
1. Comparison operators
>, >=, =, <=, <, <>,!>,!< size comparison
Select age from T_userinfo where age<=30 and age>0
2. Range operator
SELECT * from T_userinfo where age between 1 and 30
3. List operators
SELECT * from T_userinfo where type in (' Premium Member ', ' Platinum Member ')//Query membership level is premium and platinum SELECT * from T_userinfo where type not in (' ordinary member ')// Query is not a regular member
4. Logical operators
SELECT * from T_userinfo where age>20 and type= ' Advanced members ' select * from T_userinfo where age>20 and type in (' Premium member ')
5. Null value operator
SELECT * FROM T_userinfo where username are nullselect * from T_userinfo where username are not null
6. Pattern operators
% matches any type and length of characters. For example a%, which represents a string of any length beginning with a
_ matches any single character. For example, A_b, a string with a length of 3 that begins with a and ends with B
[] User-specified range, for example [A-h], representing any single character within the A~h range
[^] User-specified range, for example [^a~h], representing any single character outside of the A~h range
SELECT * FROM T_userinfo where username like '% yuan% ' select * from T_userinfo where username like ' a____ '//query with a letter beginning with a length of 5. such as admin
MSSQL Query method