Mysql資料庫-使用的查詢語句大全
阿新 • • 發佈:2018-12-13
常規查詢
- 查詢所有欄位:
select * from 表名;
- 查詢指定欄位:
select 列1,列2,... from 表名;
- 使用 as 給欄位起別名:
select 欄位 as 名字.... from 表名;
- 查詢某個表的某個欄位:
select 表名.欄位 .... from 表名;
- 可以通過 as 給表起別名:
select 別名.欄位 .... from 表名 as 別名;
- 消除重複行:
distinct 欄位
條件查詢
㈠比較運算子:>, <, >=, <=, =, !=, <>
㈡邏輯運算子:and, or, not
㈢模糊查詢:like, rlike
㈣範圍查詢:in,not in,between…and,not between…and
空判斷