Data Querying
1. a. 数据:CRUD ( 增删查改Post, Get, Put, Delete)
b. 集合: 子交并补
c.优化
2. SELECT...FROM...
- e.g SELECT TOP 100 * FROM Tablename (取范围)
- e.g SELECT TOP 10 PERCENT * FROM Tablename (取比例范围)
- e.g select 列名1,列名2 from tablename (大小写不敏感,逗号分开)
- SELECT 列名1 as 新名,列名2 as 新名 FROM tablename (取名)
- e.g SELECT
- FirstName, LastName, FirstName+' '+LastName AS FullName From (计算列)
- ORDER BY FirstName, DESC倒序 LastName ASC正序 (排序)
- SELECT DISTINCT
- SELECT FN, LN From Tablename WHERE FN="name"(不等于 !=) (条件)
- WHERE FN="" or LN=""
- WHERE productID Between.. AND..
- Comparison Operator: <> not equal, != not equal to, !< not less than, !> not greater than.
If 200> ANY(SELECT ProductID FROM tablename)
BEGIN
SELECT 'YES"
END
ELSE
BEGIN
SELECT'NO'