1、从 "Websites" 表的 "country" 列中选取唯一不同的值,也就是去掉 "country" 列重复值:
select DISTINCT country from Websites
2、从 "Websites" 表中选取国家为 "CN" 的所有网站:
select * from Websites where country = ‘CN‘
3、从 "Websites" 表中选取国家为 "CN" 且alexa排名大于 "50" 的所有网站:
+----+--------------+---------------------------+-------+---------+
| id | name | url | alexa | country |
+----+--------------+---------------------------+-------+---------+
| 1 | Google | https://www.google.cm/ | 1 | USA |
| 2 | 淘宝 | https://www.taobao.com/ | 13 | CN |
| 3 | 菜鸟教程 | http://www.runoob.com/ | 4689 | CN |
| 4 | 微博 | http://weibo.com/ | 20 | CN |
| 5 | Facebook | https://www.facebook.com/ | 3 | USA |
+----+--------------+---------------------------+-------+---------+
select * from Websites where country=‘CN‘ AND alexa>50