use world;
SELECT IFNULL(Continent,'yyy') AS xxx, AVG(Population) AS avg_pop FROM Country GROUP BY Continent WITH ROLLUP;
+---------------+---------------+
| xxx | avg_pop |
+---------------+---------------+
| Asia | 72647562.7451 |
| Europe | 15871186.9565 |
| North America | 13053864.8649 |
| Africa | 13525431.0345 |
| Oceania | 1085755.3571 |
| Antarctica | 0.0000 |
| South America | 24698571.4286 |
| yyy | 25434098.1172 |
+---------------+---------------+
====把查询结果集存为html文件,放到apache目录下,在浏览器中可以直接浏览;也可以存为xml文件,把参数-H 改为: -X
mysql -uroot -p -Dworld -H --default-character-set=utf8 -e "select * from Country;" > /var/www/html/Country.html
阅读(2246) | 评论(0) | 转发(0) |