当前位置:网站首页>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; 
边栏推荐
- Data storage - interview questions
- Unity elementary case notes of angry birds Siki college 1-6
- Pytorch learning notes 5: model creation
- MySQL 8.0.12 error: error 2013 (HY000): lost connection to MySQL server during query
- D23:multiple of 3 or 5 (multiple of 3 or 5, translation + solution)
- Selenium library 4.5.0 keyword explanation (III)
- Gossip about redis source code 77
- 2022 t elevator repair registration examination and the latest analysis of T elevator repair
- Analysis on the scale of China's smart health industry and prediction report on the investment trend of the 14th five year plan 2022-2028 Edition
- Test the influence of influent swacth on the electromagnetic coil of quartz meter
猜你喜欢

Report on prospects and future investment recommendations of China's assisted reproductive industry, 2022-2028 Edition

Smart fan system based on stm32f407

Iclr2022: how does AI recognize "things I haven't seen"?

Reading notes on how programs run
![[source code] VB6 chat robot](/img/89/46b67f627c8257eaddc70a247c9ba5.jpg)
[source code] VB6 chat robot

Tencent interview: can you pour water?

What is the Valentine's Day gift given by the operator to the product?
![[GNN] hard core! This paper combs the classical graph network model](/img/a7/2140744ebad9f1dc0a609254cc618e.jpg)
[GNN] hard core! This paper combs the classical graph network model

Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?

Kubedl hostnetwork: accelerating the efficiency of distributed training communication
随机推荐
Double efficiency. Six easy-to-use pychar plug-ins are recommended
D27:mode of sequence (maximum, translation)
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
STM32 key light
[CSDN Q & A] experience and suggestions
2022 t elevator repair registration examination and the latest analysis of T elevator repair
How can I get the Commission discount of stock trading account opening? Is it safe to open an account online
Amway by head has this project management tool to improve productivity in a straight line
D29:post Office (post office, translation)
Is user authentication really simple
2022 free examination questions for hoisting machinery command and hoisting machinery command theory examination
It is forbidden to splice SQL in code
Gossip about redis source code 79
How to write a good title of 10w+?
炒股開戶傭金優惠怎麼才能獲得,網上開戶安全嗎
Global and Chinese market of glossometer 2022-2028: Research Report on technology, participants, trends, market size and share
leetcode-43. String multiplication
Ningde times and BYD have refuted rumors one after another. Why does someone always want to harm domestic brands?
Development and application of fcitx functional plug-ins
Gossip about redis source code 73