当前位置:网站首页>Basic SQL DQL
Basic SQL DQL
2022-07-27 23:03:00 【Cold Lane (* _*)】
Catalog
grammar
| select+ Field list | The basic query |
| from+ List of table names | The basic query |
| where+ List of conditions | Conditions of the query |
| group by+ Group field list | Group query |
| having+ Condition list after grouping | Group query |
| order by+ Sort field list | Sort query |
| limt+ Paging parameters | Paging query |
The basic query
1. Query multiple fields
select Field 1, Field 2, Field 3,…… from Table name ;select * from Table name ;2. Set alias
select Field 1 [as Alias 1], Field 2[as Alias 2] …… from Table name ;3. Remove duplicate records
select distinct Field list from Table name Conditions of the query
grammar
select Field list from Table name where List of conditions ;Conditions


Aggregate functions
Take a column of data as a whole , Do the longitudinal calculation .

grammar
select Aggregate functions ( Field list ) from Table name ;
Group query
grammar
select Field list from Table name [where Conditions ] group by Group field name [having Filter conditions after grouping ];Sort query
grammar
select Field list from Table name order by Field 1 sort order 1, Field 2, sort order 2;sort order
1. asc: Ascending ( Default )
2. desc: Descending
Paging query
grammar
select Field list from Table name limit Actually , Number of query records ;Be careful
Starting index from 0 Start , Starting index =( Look up the page number -1)* Each page shows the number of records .
Paging query is the dialect of database , Different databases have different implementations ,mysql Medium is limit.
If the query is the first page of data , The starting index can be omitted , Directly abbreviated as limit 10.
Execution order

边栏推荐
- 一篇搞定Redis中的BigKey问题
- PX4模块设计之十三:WorkQueue设计
- It is said that Intel will adopt TSMC 6nm EUV process next year
- 2022年软件开发的趋势
- ADI, Shijian and Junlong technology jointly donated 2.3 million yuan to help fight the epidemic in Hubei
- Take you to master makefile analysis
- 细胞CLE19多肽荧光成像牛血清白蛋白荧光猝灭量子点的制备
- Shuffle, partition and read of tfrecord
- It is said that Huawei will cut the order again! Supply chain manufacturers are more difficult
- Promise解决异步
猜你喜欢

Jeninkins offline deployment

浅析云原生应用安全组织架构

Main security risks and Countermeasures of cloud computing services

你想被开除吗?来看看程序员「离职小技巧」吧

干货|语义网、Web3.0、Web3、元宇宙这些概念还傻傻分不清楚?(中)

Take you to master makefile analysis

Dry goods semantic web, Web3.0, Web3, metauniverse, these concepts are still confused? (medium)

Parameter transmission of components

Chrome realizes automated testing: recording and playback web page actions

Object creation process and object layout
随机推荐
2022 / 4 / 11 exam summary
20字符短域名绕过复现
`What is the difference between SSH -y` (trusted X11 forwarding) and 'SSH -x` (untrusted X11 forwarding)?
雅思听力——剑雅5——Text1
[cloud native] deploy redis cluster in k8s
Purple light FPGA solves the mask problem! Boost the overall speed-up of mask production
三星存储工厂又发生火灾!
2022/3/10 考试总结
2022/3/22考试总结
Motorola v. hytera: hytera was awarded 5.3 billion yuan
The follow-up is coming. Whether it's OK without reference, let's make it clear to everyone at once!
2022年五大网络管理趋势
Buuctf brushes eleven questions (05)
已有6名员工确诊!三星第三度关闭龟尾手机工厂!
2022/5/17考试总结
Object creation process and object layout
视频人体行为检测
If there is no reference ground at all, guess if you can control the impedance?
联合省选2022复习计划
Zhihu data analysis training camp all-round class