.DQL 数据查询语言(核心) :select(查询)
· 条件查询 : where , distinct , 逻辑运算符
· 分组 :group by having
· 排序 :order by
· 常用函数等
· 子查询
· 多表关联 :左连接
在SQL server中常用5类的函数:字符串函数,日期函数,数学函数,系统函数,聚合函数。
字符串函数
--常用的字符串函数
- 1.charindex() -- 字符索引
- 2.len() -- 长度
- 3.upper() -- 大写
- 4.Ltrim() -- 左裁减
- 5.Rtrim() -- 右裁减
- 6.Left() -- 左
- 7.Right() -- 右
- 8.stuff() -- 删除并添加
- 9.replace() -- 查找并替换
/* charindex() 用来查询指定字符串在另一个字符串中的起始位置
Len :按长度来排序
例:
Select AchievementID,UserID,StTime
from [dbo].[PW_Achievement]
order by len( AchievementID ) asc
1.查询表单信息
(1)如何查询表的所有内容
SELECT * FROM