数据分析4

编程入门 行业动态 更新时间:2024-10-09 17:30:54

<a href=https://www.elefans.com/category/jswz/34/1771445.html style=数据分析4"/>

数据分析4

一:基础语句

1.1 select

select from

从表中返回指定的字段,一行代码不用分号

selec * from 

 返回表全部内容

selec A as B from 

把A的列名改成B,然后返回

select distinct A from

只返回A列不一样的数据

select  A/B C from

将a除以b的值命名为c返回

1.2 where(加在from后面)

例子1:人口大于两个亿国家的人均gdp

select gdp/population 人均gdp from world where population>=2000000000

例子2:中国的人口

select population from world
where name='CHina'

注意:等于字符串数据需要加单引号,不能是双引号,另外,字符串并不区分大小写。

例子3:中国和美国的人口

select population from world

where name in ('china','america')

select population from world

where name=’china‘ or name='america'

括号中数据表示一个列表

例子4:面积在250000和300000之间的国家名称和面积

select area, name from world

where area between 25000 and 300000

例子5:查询以c开头ia结尾的国家的名称(模糊查询 like )

select area, name from world

where name like 'c%ia'

例子6:查询第二位是t的国家的名称

select area, name from world

where name like '_t%'

例子6:查询名称中有两个o,被两个字符隔开

更多推荐

数据分析4

本文发布于:2024-02-16 18:15:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1691023.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!