INSERT INTO city VALUES(1,'上海',2018,32679,2418);INSERT INTO city VALUES(2,'北京',2018,30320,2171);INSERT INTO city VALUES(3,'深圳',2018,24691,1253);INSERT INTO city VALUES(4,'广州',2018,23000,1450);INSERT INTO city VALUES(5,'重庆',2018,20363,3372);INSERT INTO city VALUES(6,'上海',2019,38155,2424);INSERT INTO city VALUES(7,'北京',2019,35371,2171);INSERT INTO city VALUES(8,'深圳',2019,26927,1302);INSERT INTO city VALUES(9,'广州',2019,23628,1491);INSERT INTO city VALUES(10,'重庆',2019,23605,3372);
COUNT
查询计算2019年一共有多少个城市录入数据(答案 5个)
SELECT COUNT(*) FROM city WHERE city_year = '2019';
MAX
查询 2018年里 GDP 最高是多少;
SELECT MAX(city_gdp) FROM city WHERE city_year = '2018';
MIN
查询 2018年里 GDP 最低是多少;
SELECT MIN(city_gdp) FROM city WHERE city_year = '2018';
SUM
查询2019年里所有城市 GDP 总和;
SELECT SUM(city_gdp) FROM city WHERE city_year = '2019';
AVG
查询2019年所有城市 GDP 平均值;
SELECT AVG(city_gdp) FROM city WHERE city_year = '2019';