当前位置:网站首页>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; 
边栏推荐
- Minimum commission for stock account opening. Stock account opening is free. Is online account opening safe
- Tencent interview: can you pour water?
- P1339 [USACO09OCT]Heat Wave G
- I would like to ask how the top ten securities firms open accounts? Is it safe to open an account online?
- Ramble 72 of redis source code
- How to trade spot gold safely?
- Global and Chinese market of underwater bags 2022-2028: Research Report on technology, participants, trends, market size and share
- How will the complete NFT platform work in 2022? How about its core functions and online time?
- [MySQL] sql99 syntax to realize multi table query
- Celebrate the new year | Suihua fire rescue detachment has wonderful cultural activities during the Spring Festival
猜你喜欢

Yyds dry goods inventory three JS source code interpretation - getobjectbyproperty method

A Kuan food rushed to the Shenzhen Stock Exchange: with annual sales of 1.1 billion, Hillhouse and Maotai CCB are shareholders

"Learning notes" recursive & recursive

2022 a special equipment related management (elevator) examination questions and a special equipment related management (elevator) examination contents

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

Detailed explanation of the relationship between Zhongtai, wechat and DDD

Briefly understand the operation mode of developing NFT platform

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

Amway by head has this project management tool to improve productivity in a straight line

Deep learning ----- using NN, CNN, RNN neural network to realize MNIST data set processing
随机推荐
Smart fan system based on stm32f407
P1656 bombing Railway
How to make recv have a little temper?
NLP Chinese corpus project: large scale Chinese natural language processing corpus
[PHP basics] cookie basics, application case code and attack and defense
[NLP] text classification still stays at Bert? Duality is too strong than learning framework
How to trade spot gold safely?
[2021]NeRF in the Wild: Neural Radiance Fields for Unconstrained Photo Collections
Global and Chinese markets for blood and liquid heating devices 2022-2028: Research Report on technology, participants, trends, market size and share
Pytorch learning notes 5: model creation
Briefly understand the operation mode of developing NFT platform
Global and Chinese market of melting furnaces 2022-2028: Research Report on technology, participants, trends, market size and share
Global and Chinese market of glossometer 2022-2028: Research Report on technology, participants, trends, market size and share
2022 chemical automation control instrument examination content and chemical automation control instrument simulation examination
炒股開戶傭金優惠怎麼才能獲得,網上開戶安全嗎
No qualifying bean of type ‘com. netflix. discovery. AbstractDiscoveryClientOptionalArgs<?>‘ available
After the Lunar New Year and a half
Make small tip
Fudan 961 review
[source code] VB6 chat robot