基本查询:
1) 查询时加一条固定字段, 例如Student信息后面添加一个班级(‘普通班‘)
select id, name, ‘普通班‘ as 班级 from Student
2) 查询时去重, 例如查询学生的居住地
select distinct adress from table_name 或者 select distinct(adress) from table_name
3) 查询时合并某几列的数值, 例如显示总成绩
select name, (English + Math) 总成绩 from table_name
条件查询: (where)
1) 逻辑条件: ‘and‘与 ‘or‘或
2) 比较: ‘>‘ ‘<‘ ‘=‘ ‘>=‘ ‘<=‘ ‘<>‘不等于 ‘between xx1 and xx2‘ <==> ‘>= xx1 and <= xx2‘
3) 判断空(null vs 空字符串): ‘is null‘ / ‘is not null‘ / ‘=‘‘‘ / ‘<>‘‘‘
4) 模糊判断: ‘like‘
原文:http://www.cnblogs.com/webyyq/p/6501162.html