SQL 查询
SQL 查询
SQL SELECT
SELECT column1, column2, ... FROM table_name; * 代表全部列名 [推荐] 分别列出查询列名
SQL DISTINCT[去重复]
SELECT DISTINCT column1, column2, ... FROM table_name; [注意]仅返回不同的数据行,相同行数据只显示一行
SQL WHERE[带子句]
SELECT column1, column2, ... FROM table_name WHERE condition; [子句]
= 等于
<> 不等于 [!=]
\> 大于
< 小于
\>= 大于等于
<=小于等于
BETWEEN范围
LIKE 相似
IN ()内容
SQL AND & OR [运算符]
SELECT column1, column2, ... FROM table_name WHERE condition1 AND condition2 OR condition3 NOT condition4 ...; [运算符]为真 执行返回,为假 执行跳过忽略
SQL ORDER BY[按关键字排序]
SELECT column1, column2, ... FROM table_name ORDER BY column1, column2, ... ASC|DESC; [备注] ORDER BY 关键字用于按升序或降序对结果集进行排序。 ORDER BY 关键字默认情况下按升序排序记录。