当前位置:网站首页>The specified data is grouped and the number of repetitions is obtained in Oracle
The specified data is grouped and the number of repetitions is obtained in Oracle
2022-07-24 22:33:00 【Milk coffee 13】
One 、 Business needs
The business needs to realize grouping for the specified fields , And get the repetition times of the content under each group after grouping ; Also get the duplicate personnel information content .
such as : I have a personnel information form here , I need to know about all age groups after , The age repeats those ? Then get the personnel information of repeated content .
Two 、 Thought analysis
Oracle in ① For grouping Group by Having sentence ;② Although there is no direct access to repeated statements , But you can use Count After obtaining the number , We are making a comparison to make the number greater than 1 You can get the duplicate content ;③ Can be used for comparison IN Condition or exists Conditions .


3、 ... and 、 Implementation method
3.1、 Group the specified data and get the number of repetitions syntax
SELECT You need to judge the duplicate field name ,COUNT( You need to judge the duplicate field name )repateNumber FROM Table name GROUP BY You need to judge the duplicate field name HAVING COUNT( You need to judge the duplicate field name )>1 3.2、 Group the specified data and get the repeated content information syntax
SELECT * FROM Table name WHERE Duplicate field name to be judged IN (SELECT Duplicate field name to be judged FROM Table name GROUP BY Duplicate field name to be judged HAVING COUNT( Duplicate field name to be judged )>1 ) 3.3、 Take the content of personnel information table as an example
3.3.0、 Contents of personnel information table

3.3.1、 Get what age is repeated in the personnel information table and how many times
SELECT "Age",COUNT("Age")repateNumber FROM "PeopleInfo" GROUP BY "Age" HAVING COUNT("Age")>1

3.3.2、 Get the personnel information with the same age in the personnel information table
SELECT * FROM "PeopleInfo" WHERE "Age" IN (SELECT "Age" FROM "PeopleInfo" GROUP BY "Age" HAVING COUNT("Age")>1 ) 
边栏推荐
- Gradle learning - gradle advanced instructions
- 物联网平台返回数据解析时遇到org.json.JSONException: No value for Value怎么办
- Morris遍历
- EL & JSTL: JSTL summary
- How about Minsheng futures? Is it safe?
- GlideModule AppGlideModule和Generated API详解
- RichTextBox operation
- Local data enhancement method of icml2022 | graph neural network
- Process / thread synchronization mechanism
- "Fundamentals of program design" Chapter 10 function and program structure 7-2 Hanoi Tower problem (20 points)
猜你喜欢

AVL tree of ordered table

Time series data in industrial Internet of things

IndexTree

一文读懂Elephant Swap的LaaS方案的优势之处

Outlook邮件创建的规则失效,可能的原因

A compatible, smaller and easy-to-use web font API

物联网平台返回数据解析时遇到org.json.JSONException: No value for Value怎么办

【1184. 公交站间的距离】

From A76 to A78 -- learning arm microarchitecture in change

阿里云SSL证书
随机推荐
Brainstorming -- using reduce method to reconstruct concat function
PHP get thumbnails
TrinityCore魔兽世界服务器-注册网站
Filter list
Enterprise operation we media can't "self Hi": the content should be grounded, not advertising
Homework of the 20th week
Time series data in industrial Internet of things
Gradle learning - gradle advanced instructions
Okaleido tiger NFT即将登录Binance NFT平台,后市持续看好
PCL点云处理之直线点集投影规则化(五十六)
《元宇宙2086》单日销量超《三体》 夺得京东图书单日科幻榜冠军
关于板载继电器供电不足引起不能吸合的问题
工业物联网中的时序数据
ASP. Net core 6.0 data validation based on model validation
[which is better to use, apopost or apifox? Just read this!]
[1184. Distance between bus stops]
Multi task face attribute analysis based on deep learning (based on paddlepaddle)
CA证书制作实战
暴力递归——N皇后详解 && 如何用位运算进行优化
Plane regularization of PCL point cloud processing (55)