1.根据两张表查询张三成绩
select t1.sname,t2.mark from t1,t2 where t1.sid=t2.sid and t1.sname=’zhang3’;
2.世界上小于100人的人口城市是哪个国家的
select city.name,city.countrycode,country.name from city,country where city.countrycode=country.code and city.population<100;
1.查询,人口在100以上的城市名字,和所说的语言
select city.name,countrylanguage.language from city natural join countrylanguage where population >
100
1.都到这了,还看不懂,自杀去吧
select city.name,city.countrycode,country.name from city join country on city.countrycode=country.code where city.population<100;
1.略。。。。
select city.name,city.countrycode,country.name from city left join country on city.countrycode=country.code and city.population<100;
1.为什么用union,因为他快啊,虽然打起来贼特么麻烦,但他运行效率非常快,优化语句用就是了
#范围查询or语句 mysql> select * from city where countrycode='chn' or countrycode='usa'; #范围查询in语句 mysql> select * from city where countrycode in ('chn','usa'); 替换为: mysql> select * from city where countrycode='chn' union all select * from city where countrycode='usa' limit 10
如对本文有疑问, 点击进行留言回复!!
网友评论