当前位置:网站首页>MySQL winter vacation self-study 2022 12 (1)
MySQL winter vacation self-study 2022 12 (1)
2022-07-04 00:19:00 【Crane paper thousand】
function
group_concat
Data preparation
create database mydb4;
use mydb4;
create table emp
(
emp_id int primary key auto_increment comment ' Number ',
emp_name char(20) not null default '' comment ' full name ',
salary decimal(10,2) not null default 0 comment ' Wages ',
department char(20) not null default '' comment ' department '
);
insert into emp(emp_name,salary,department)
values(' Zhang Jingjing ',5000,' Finance Department '),
(' Wang Feifei ',5800,' Finance Department '),
(' Zhao Gang ',6200,' Finance Department '),
(' Liu Xiaobei ',5700,' The personnel department '),
(' Wang Dapeng ',6700,' The personnel department '),
(' Zhang Xiaofei ',5200,' The personnel department '),
(' Liu yunyun ',7500,' The sales department '),
(' Liu Yunpeng ',7200,' The sales department '),
(' Liu Yunpeng ',7800,' The sales department ');part1
-- Put the names of all employees in one line
select group_concat(emp_name) from emp;The operation results are as follows

part2
-- Specify the separator
select group_concat(emp_name separator ';') from emp;The operation results are as follows

part 3
-- Splicing after grouping
select department,group_concat(emp_name separator ';') from emp group by department;
part 4 Sort by salary
-- Splicing after grouping , And sort
select department,group_concat(emp_name order by salary desc separator ';') from emp group by department; 
边栏推荐
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
- Global and Chinese market of breast cancer imaging 2022-2028: Research Report on technology, participants, trends, market size and share
- Private project practice sharing populate joint query in mongoose makes the template unable to render - solve the error message: syntaxerror: unexpected token r in JSON at
- D30:color tunnels (color tunnels, translation)
- Generic tips
- 2022 t elevator repair registration examination and the latest analysis of T elevator repair
- Selenium library 4.5.0 keyword explanation (III)
- Subgraph isomorphism -subgraph isomorphism
- SPI based on firmware library
- D26: the nearest number (translation + solution)
猜你喜欢

2022 examination of safety production management personnel of hazardous chemical production units and examination skills of safety production management personnel of hazardous chemical production unit

JDBC Technology

2022 Guangdong Provincial Safety Officer a certificate third batch (main person in charge) simulated examination and Guangdong Provincial Safety Officer a certificate third batch (main person in charg
![[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections](/img/c6/3dc7d01600f6713afdbb4cf3df5238.jpg)
[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections

URL (data:image/png; Base64, ivborw0k... Use case

Zipper table in data warehouse (compressed storage)

MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query

2022 system integration project management engineer examination knowledge points: software development model
![[about text classification trick] things you don't know](/img/c0/fdb04f6b31f1dba2658c2430dc4036.jpg)
[about text classification trick] things you don't know

"Learning notes" recursive & recursive
随机推荐
Idea set class header comments
D28:maximum sum (maximum sum, translation)
Solution to the impact of Remote Code Execution Vulnerability of log4j2 component on December 9, 2021
Global and Chinese market of breast cancer imaging 2022-2028: Research Report on technology, participants, trends, market size and share
Analysis of refrigeration and air conditioning equipment operation in 2022 and examination question bank of refrigeration and air conditioning equipment operation
Gossip about redis source code 74
Celebrate the new year | Suihua fire rescue detachment has wonderful cultural activities during the Spring Festival
Enter MySQL in docker container by command under Linux
What does redis do? Redis often practices grammar every day
What is the difference between NFT, SFT and dnft? How to build NFT platform applications?
1214 print diamond
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of underwater bags 2022-2028: Research Report on technology, participants, trends, market size and share
【leetcode】300. Longest increasing subsequence (dynamic programming, dichotomy)
Social network analysis -social network analysis
Research Report on the scale prediction of China's municipal engineering industry and the prospect of the 14th five year plan 2022-2028
[complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
Cannot build artifact 'test Web: War expanded' because it is included into a circular depend solution
2022 t elevator repair registration examination and the latest analysis of T elevator repair
Detailed explanation of the relationship between Zhongtai, wechat and DDD