第4章 例题(子查询和group by子句)(The fourth chapter is the example (subquery and group by clause)).docVIP
- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
第4章 例题(子查询和group by子句)(The fourth chapter is the example (subquery and group by clause))
第4章 例题(子查询和group by子句)(The fourth chapter is the example (subquery and group by clause))
The syntax format of the select statement:
Select [distinct] 1 field, 2 field, 3 field, n field | * from...
[where expression for query criteria]
[grop by packet fields]
Conditions for adding data to each group after [having grouping
[order by [asc|desc]] | sort field sort expression
4.2.1 select column
1, select the specified column
In 4.5 cases
Use xscj;
Select name, professional name, total credits from, xs;
2, define column alias
Example 4.6 defines the column alias (defined in the Mysql alias only in this format)
Select student number as number, name as name, total credits as, mark, from, xs;
When the column alias has spaces, both ends of the alias are enclosed in single quotes.
Select student number as,Student, number, name as,Student, name, total credits as, mark, from, xs;
If a column alias is specified as uppercase, no single quotation marks are added, and uppercase is used as follows.
Select student number as NUMBER, name as NAME, total credits as, MARK, from, xs;
3, replace the data in the query results
The format of the case expression:
Case when condition 1 then expression 1
When condition 2 then expression 2
...
When condition n then expression n
Else expression
End
Example 4.7 uses the case statement to replace the querys raw data.
Select number, name, case
When total credits is, null, then have not been selected yet
When total credits 50 then failed
When total credits =50, and, total credits, =52, then, qualified
Else excellent
End as class
From XS where professional name = computer;
4 calculate column values
In 4.8 cases
Select student number, course number, grades *1.20 as, grades 120, from, xs_kc, where, student number =081101;
5. Eliminate repeated rows of results
In 4.9 cases
Select distinct professional name, total credits from, xs;
6, aggregation function (statistical summary function)
Example 4.10
Select count (*) as student total from xs;
Example 4.11
Se
您可能关注的文档
- 液晶算法(Liquid crystal algorithm).doc
- 液晶维修经验(LCD maintenance experience).doc
- 淄博历史人物(Historical figures of Zibo).doc
- 液晶触摸一体机(Liquid crystal touch integrated machine).doc
- 淄河中学 翟淑静(The Zihe River middle school Zhai Shujing).doc
- 淮北地区山药炭疽病的发生特点及防治技术(Occurrence characteristics and control techniques of yam Anthracnose in Huaibei area).doc
- 淮北首家民营企业管理企业年金花落祥泰科技(Huaibei's first private enterprise in the golden flowers Xiangtai Technology).doc
- 液晶面前,谁在狂舞(The liquid crystal in front, who in the dance).doc
- 淮南牛肉汤(Huainan beef soup).doc
- 淮南矿业集团较严重 三违行为界定(Huainan Mining Group is serious three violations behavior).doc
- 第6次重组若失败将暂停上市(If the sixth reorganization fails, the listing will be suspended).doc
- 第6章 函数设计(The sixth chapter, function design).doc
- 第8章 电子商务项目与项目管理软件(The eighth chapter is e-commerce project and project management software).doc
- 第4课 夏、商、西周的兴亡(The rise and fall of fourth class Xia, Shang and Western Zhou Dynasty.).doc
- 空资料主板(Null data board).doc
- 第9章 竞争性市场营销战略(The ninth chapter is competitive marketing strategy).doc
- 第一批异形词整理表(The first batch of odd word sorting tables).doc
- 第一单元硫酸的制备和性质(Unit 1 Preparation and properties of sulphuric acid).doc
- 第一章 绪 论(The first chapter is introduction).doc
- 第13章-多电机拖动系统(The thirteenth chapter - multi motor drive system).doc
原创力文档


文档评论(0)