SQL学习之路:1

select name,continent,population from world

select * from world

查询所有字段

select distinct continent from world

选择的字段去重

select distinct continent ,name from world

对行中数据字段去重

select gdp/population 人均GDP from world

可直接进行字段计算or函数计算

SELECT name, population FROM world
WHERE name in('Sweden','Norway','Denmark')

查询条件范围内所有的相应字段

SELECT name, area FROM world
WHERE area between 2000000 and 30000000

查询条件区级的相应字段

select name,area from world
where area between 25000 and 30000
and area <>29743

(between and 包含边界数据)

select name from world
where name like 'C%ia'

模糊查询,通配符%为任意字符出现任意次数

select name from world
where name like '_t%'

模糊查询,通配符_为任意字符出现一次次数

select name from world
where name like '%A%A%a'and area >3000000

满足多条件查询,and(优先级大于or)

select name from world
where name like '%A%A%a' or area >3000000

满足多条件查询,or

上一篇:07.常用的SQL语句


下一篇:阿里云MSE 2.0重磅发布,乘风破浪加速企业微服务化进程