select * from nobel where subject not in (‘Chemistry’, ‘Medicine’) order by subject in (‘Chemistry’, ‘Physics’) 排在最后
select name from world where name like ‘%a%’ and name like '%o% and ’ name like ‘%e%’ and name like ‘%i%’ and name like ‘%u%’ and name not like ‘% %’ 包含所有元音字母,不包含空格
select winner, yr, subject from nobel order by yr desc, winner asc 降序与升序
select name, population from world limit 3, 4 查询第4行到第7行的数据[4567行]
select sum(population) from world where continent = ‘Africa’ 非洲总人口
select count(*) from world 表的总行数
select count(name) from world
select continent, count(name) from world group by continent group by 先分区在分组
select yr, subject, count(winner) from nobel where yr in (2013, 2014) group by yr, subject order by yr desc, count(winner) desc
select sum(population) from world where name in (‘Estonia’, ‘Latvia’ , ‘Lithuania’) 国家总人口
select continent, count(name) from world where population > 10000000 group by continent 国家个数
select continent, sum(population) ssm from world group by continent having ssm >= 100000000 总人口
select continent, avg(gdp) from worldwhere (gdp > 20000000000 and population > 60000000) or (gdp > 8000000000 and capital like ‘%a%a%a%’) group by continent having sum(population) >= 3000000000 order by count(name) desc limit 1
select continent, sum(population), sum(gdp) / sum(population) avg from world where gdp between 20000000000 and 30000000000 group by continent having sum(gdp) / sum(population) > 3000 人均GDP