--1 Building Table
CREATE TABLE City_table
(
City_name VARCHAR2 (100)
, District varchar2 (100)
);
--2 Inserting data
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Dongcheng District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Xicheng ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Chongwen District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Xuanwu ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Chaoyang ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Haidian ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Fengtai ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Shijingshan ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Mentougou ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Fangshan ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Tongzhou District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Shunyi District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Changping District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Daxing District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Huairou ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Pinggu District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Miyun ');
Insert into city_table (City_name, DISTRICT) VALUES (' Beijing ', ' Yanqing County ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Hedong ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Hexi District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Nankai District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Hebei District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Hongqiao District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Tanggu District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Hangu District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Grand Port District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Dongli District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Xiqing District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Beichen District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Jinnan District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Wuqing District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Baochi District ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Jinghai County ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Ninghe County ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' Jixian ');
Insert into city_table (City_name, DISTRICT) VALUES (' Tianjin ', ' heping ');
Commit
--attack.
Select City_name,wm_concat (district| | Chr (10))
From city_table
Group BY City_name;
--the result is that the child information in it is arranged in a row (CHR), Chr (10))
Chr (9) functions as a space
ASCII Chr (9), CHR, Chr (13) usage in Oracle