Home > database >  Query three countries with the most fans of each team two group, query each shows three maximum numb
Query three countries with the most fans of each team two group, query each shows three maximum numb

Time:09-27

The CREATE TABLE ` fans ` (
` id ` int (20) NOT NULL,
` team ` varchar (10) DEFAULT NULL,
` nationality ` varchar (20) DEFAULT NULL,
` fanCount ` int (10) DEFAULT NULL,
The PRIMARY KEY (` id `)
)

Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 1 ', 'Barcelona', 'Germany', '12000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 2 ', 'Barcelona', '-', '18000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 3 ', 'Barcelona', 'China', '13000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 4 ', 'Barcelona', 'USA', '15000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 5 ', 'Barcelona', 'in Italy', '11000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 6 ', 'Real Madri' and 'France', '19000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 7 ', 'Real Madri', 'Germany', '13000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 8 ', 'Real Madri' and 'USA', '17000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 9 ', 'Real Madri', 'Chesapeake', '16000');
Insert into ` fans ` (` id `, ` team `, ` nationality `, ` fanCount `) values (' 10 ', 'Real Madri', 'the UK', '12000');

CodePudding user response:

Slowly, you first clarify requirements, according to the team grouped query each group of followers top three countries and the number of fans
Is that what you mean?

CodePudding user response:

Right, it is this meaning
  • Related