selcet city,positionId from data_yxd.dataanalyst
order by positionId? desc(從大到小)(沒(méi)有desc的時(shí)候是從小到大 )
selcet * from data_yxd.dataanalyst
where city= "杭州"
where conpanyId between 100 and 140
where companyId in (a,b)? 表示當(dāng)companyId是a和b的時(shí)候? or 也能表示這意思
<>和!= 是一個(gè)意思? not in表示in的否定
where city ="BJ"? and education="本科" and ...
如果想要在北京? 且本科畢業(yè)或者工作年限1-3年
selcet * from data_yxd.dataanalyst
where city="BJ"
and education ='本科'
or workyear='1-3年'? 此時(shí)默認(rèn)的是把a(bǔ)nd先為默認(rèn)條件芙粱,是不符合本意的庐椒,改的話在education前 workyear后加括號(hào)
like的用法
selcet * from data_yxd.dataanalyst
where secondType like '%開(kāi)發(fā)%'? 這時(shí)是只要有'開(kāi)發(fā)'字符就行
'前段%' 這時(shí)就是能搜索出來(lái)? 前段開(kāi)發(fā)? 前段人員 等等
'%前段' 這時(shí)是 xx前段?
group by 的用法
selcet city,count(postionId) from data_yxd.dataanalyst
group by city? ? ? ? ? ? 注意這時(shí) 最好不要使用星號(hào)*而是使用group by 后面的字符,因?yàn)橛械臅?huì)報(bào)錯(cuò)柜蜈,因?yàn)橛行﹕ql要求完全等同于字段
select city,count(positionId) ,count(*),count(1) from data_yxd.dataanalyst
group by city? ? ? ? 注意? count1 和*是一樣的? 也就是按照默認(rèn)的字段去求,區(qū)別就是包不包含空值進(jìn)行計(jì)算
count(distinct companyId)? 注意? distinct 其實(shí)就是去重復(fù)指巡,