sql select语法是sql语言中最基础的语法,下面就将为您介绍sql select语法,供您参考,如果您是才接触SQL数据库的新手,不妨一看,相信对您学习sql select语法会有所帮助。
SQL查询: SELECT
普通查询:
SELECT "栏位名" FROM "表格名"
DISTINCT 查询:(去掉重复)
SELECT DISTINCT "栏位名" FROM "表格名"
WHERE 条件查询:
SELECT "栏位名" FROM "表格名" WHERE "条件"
AND 或是 OR 多条件查询:
SELECT "栏位名" FROM "表格名" WHERE "简单条件" {[AND|OR] "简单条件"}+ {}+代表{}之内的情况会发生一或多次。在这里的意思就是 AND 加简单条件及 OR加简单条件的情况可以发生一或多次。另外,我们可以用 () 来代表条件的先后次序。
IN 查询:
SELECT "栏位名" FROM "表格名" WHERE "栏位名" IN ('值一', '值二', ...)
BETWEEN 查询:
SELECT "栏位名" FROM " 表格名" WHERE "栏位名" BETWEEN '值一' AND '值二'
LIKE 查询:(模糊查询)
SELECT "栏位名" FROM "表格名" WHERE "栏位名" LIKE {套式}
ORDER BY 查询:(排序)
SELECT "栏位名" FROM "表格名" [WHERE "条件"] ORDER BY "栏位名" [ASC, DESC]
SELECT store_name, Sales, Date FROM Store_Information ORDER BY 2 DESC
这两句效果相同!
【编辑推荐】