SQL—查詢的基本用法—查
select這個是查詢和其他語法的起點
1、查詢表中的全部內容:
語法:select * from 表名
查找所有列表.png
2、條件查找
語法:select 列名 from 表名 where 查詢條件表達試
條件查找.png
3、查詢排序
語法:select 列名>from 表名 order by 排序的列名[asc或desc]
order by.png
4、模糊查詢
語法:select * from where 表名 like 條件(a%)
like用法.png
5、查詢表中不重復的數據
語法:select distinct * from 表名
注:distinct 關鍵詞用于返回唯一不同的值。
distinct用法.png
6、between用法
語法:select * from表名 where 列名 between 范圍1 and 范圍2
between用法.png
7、in 用法
語法:select * from表名 where 名 in (具體值,具體值)
in 用法.png