Home > database >  The SQL query problem
The SQL query problem

Time:10-13

Table person field ids (primary key), name (name), age (age), city (city),
1, the average age of the query: what cities is more than 50
2, query the age (from big to small) in 20 to 30 all
3, which name namesake, most people

CodePudding user response:

 
1. Select city from the person group by city having avg (age) & gt; 50;
2. Select * from the person where the age between (20, 30) order by age desc;
3. Select the name, count (1) the from person group by name;
  • Related