- 4
- 0
- 约6.29千字
- 约 15页
- 2017-08-21 发布于河南
- 举报
第4章 例题(子查询和group by子句)(Chapter fourth examples (sub queries and group by clause))
第4章 例题(子查询和group by子句)(Chapter fourth examples (sub queries and group by clause))
The select statement syntax:
Select [distinct] 1 field, 2 field, 3 field, n field | * from...
[where query expression]
[grop by group field]
[having packet data for each condition increased
[order by [asc|desc]] | sort field sort expression
Select the column 4.2.1
1, select the specified column
In 4.5 cases
Use xscj;
Select name, professional name, total credits from xs;
2, the definition of a column alias
4.6 definition column alias (defined alias only this kind of format in Mysql)
The select code as number, the name as name, as mark from XS total credits;
When a column alias alias box, with both ends of the single quotes.
Select asStudent numberas school, the name ofStudent name as mark from XS, total credits;
If the specified column alias for capital, do not need to add single quotes, upper or effect, as in the following example.
The select code as NUMBER, the name as NAME, as MARK from XS total credits;
3, replace the data in the query result
Case expression format:
Case when 1 then 1.
When 2 then 2.
...
When n then n.
The expression of else
End
The original data of 4.7 cases using the case statement to query the replacement.
Select the student number, name, case
When is null then is not the total credit course
When 50 then total credits failed
When =50 and total credits total credits =52 then qualified
Else excellent
The end as class
From XS where professional name = computer;
4, calculate the column value
In 4.8 cases
Select school, courses, grades *1.20 as 120from xs_kc where record number: =081101;
5, eliminate duplicate rows in the result set
In 4.9 cases
Select distinct professional name, total credits from xs;
6, the aggregation function (statistical function)
In 4.10 cases
Select count (*) the total number of students from XS as;
In 4.11 cases
Select count (notes) the total number of students from XS as;
In 4.12 cases
Select count (total credits) as total credits 50 points
您可能关注的文档
- 浅谈我国高空作业车发展(Elementary introduction to development of aerial work vehicle in China).doc
- 浅谈新课程理念下的小学汉语口语交际教学(Chinese oral communication teaching in primary school under the new curriculum).doc
- 浅谈新课程理念下的化学课(The chemistry class under the new curriculum).doc
- 浅谈本田。雅马哈,铃木,光阳!(On Honda. YAMAHA, SUZUKI, Guangyang!).doc
- 浅谈语文教学中的德育渗透(The infiltration of moral education in Chinese Teaching).doc
- 浅谈程序员的数学修养(On the accomplishment of mathematics programmer).doc
- 浅谈高中语文课本剧运用(On the high school Chinese textbook drama use).doc
- 测试智力(Intelligence test).doc
- 浅谈城市旅游地形象的传播策略(On the image of city tourism communication strategy.).doc
- 浅谈青年教师成长中的浮躁心理问题及对策(Impetuous psychological problems and Countermeasures of the development of young teachers).doc
- 2026《面向多样性的隐私保护推荐方法概述》7800字.docx
- 2026《基于PLC的智能立体停车场的控制系统设计》7200字.docx
- 2026《太赫兹技术概述》4200字.docx
- 2026《分布式电力系统经济调度研究现状国内外文献综述》2800字.docx
- 2026《曲美家具集团股份有限公司成本管理存在的问题及对策》5600字.docx
- 2026《基于肌肉信号的人体运动研究国内外文献综述》3400字.doc
- 2026《基于城市林学植物配置问题研究》7200字.docx
- 2026《社区重点人群管理平台设计与实现》7900字.docx
- 2026《区县医院内网的设计与实施研究》6900字.doc
- 2026《静电除尘的原理及高频电源的优势综述》3100字.doc
原创力文档

文档评论(0)