1. 程式人生 > >MySQL查詢語句(重點分類)

MySQL查詢語句(重點分類)

MySQL的查詢是一個重點,主要查詢操作包括以下內容(單表查詢重點)
  1. 查詢所有列
  2. 查詢指定列
  3. 查詢時新增常量列
  4. 查詢時合併
  5. 查詢時去除重複記錄
  6. 條件查詢
  7. 聚合查詢
  8. 分頁查詢
  9. 查詢排序
  10. 分組查詢
  11. 分組查詢後諮詢
# 查詢所有列
select * from student;
# 查詢指定列
select id,name,gender from student;
# 查詢時指定別名(as)
select id as '編號',name as '姓名' from student;
# 查詢時新增常量列,新增一個java班級列
select  id ,name,gender,age,"java"  as '年級'   from student;
# 查詢時合併列:合併列只能合併數值型別的,非數值型別的不可合併
select id,name,(servlet+jsp) as '總成績' from student;
# 查詢學生的性別, 男女去重
select distinct gender from student;
select distinct(gender) from student;
#條件查詢(where)


多表查詢重點:


個人網站:http://xudailong.cc

關注「蛇崽網盤教程資源」公眾號 ,在微信後臺回覆「領取資源」,獲取IT資源200G乾貨大全。

更多資源請訪問:

https://blog.csdn.net/xudailong_blog/article/details/78762262

某課視訊教程

https://xudailong.cc/2018/09/30/muke-courses/

關注「蛇崽網盤教程資源」公眾號 ,在微信後臺回覆「領取資源」,獲取IT資源200G乾貨大全。
在這裡插入圖片描述