mysql鐨勫鍒犳敼鏌ヨ繘闃剁増

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql鐨勫鍒犳敼鏌ヨ繘闃剁増相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/%e6%a8%a1%e7%b3%8a' title='妯$硦'>妯$硦   鎺掑簭   鍑芥暟   asc   鍒嗛〉鏌ヨ   mys   鍒嗙粍鏌ヨ   娌℃湁   select   

姣忔棩鎬荤粨
妯$硦鏌ヨlike
select * from 琛ㄥ悕 where 瀛楁 like ‘%w%’;
%:琛ㄧず浠绘剰瀛楃锛涘繀椤昏鍐欏湪寮曞彿閲岄潰锛屽鏋滃悗杈规病鏈?璇存槑w鍚庨潰涓嶄細鏈夊瓧绗︺€傚弽涔嬩害鐒?br />select * from 琛ㄥ悕 where 瀛楁 like ‘鏉巁’;
_:琛ㄧず涓€涓瓧绗︼紱蹇呴』瑕佸啓鍦ㄥ紩鍙烽噷闈紝濡傛灉鍚庤竟鏈塤浠h〃蹇呴』鏈変竴涓瓧绗︼紝鍙嶄箣浜︾劧
鎺掑簭(order by)锛屽彲浠ュ瀛楁鎺掑簭
select *from 琛ㄥ悕 order by 鍒楀悕 asc锛坅sc鍗囧簭榛樿锛沝esc闄嶅簭锛?br />鑱氬悎鍑芥暟鏌ヨ
min鏈€灏忓€?max鏈€澶у€?sum鍊肩殑鍜?count缁熻琛屾暟;avg骞冲眬鍊?br />鍒嗙粍鏌ヨ:
group by
璁℃暟鍊硷細 count(瀛楁)锛?琛ㄧず姹傚嚭涓€缁勪腑鍘熷鏁版嵁鐨勮鏁帮紱
鏈€澶у€硷細 max(瀛楁)锛岃〃绀烘眰鍑轰竴缁勪腑璇ュ瓧娈电殑鏈€澶у€硷紱
鏈€灏忓€硷細 min(瀛楁)锛岃〃绀烘眰鍑轰竴缁勪腑璇ュ瓧娈电殑鏈€灏忓€硷紱
骞冲潎鍊硷細 avg(瀛楁)锛岃〃绀烘眰鍑轰竴缁勪腑璇ュ瓧娈电殑骞冲潎鍊硷紱
鎬诲拰鍊硷細 sum(瀛楁)锛岃〃绀烘眰鍑轰竴缁勪腑璇ュ瓧娈电殑绱姞鍜岋紱
鍒嗛〉鏌ヨ
limit 璧峰琛?琛屾暟;
澶氳〃鑱斿悎鏌ヨ
join on
select * from 琛? as a join 琛? as b on a.id=b.lid where a.id =3;
left join
right join
淇勭綏鏂濞?br />select * from teacher where id =(select tid from grade group by tid order by count(*) desc limit 0,1);
鍦ㄦ煡璇腑鍙互鍏堟煡璇竴涓潯浠讹紝鐒跺悗鍐嶇敤where鎶婂畠濂椾綇锛屼綔涓轰竴涓獁here鐨刬d锛涘彲浠ュ弽澶嶅锛?/p>

以上是关于mysql鐨勫鍒犳敼鏌ヨ繘闃剁増的主要内容,如果未能解决你的问题,请参考以下文章

鍔ㄦ€佽鍒掕繘闃剁瘒1---鑳屽寘闂

濡備綍灏嗘暟鎹粠MySQL/MongoDB涓縼绉昏嚦浜戝紑鍙戞暟鎹簱

mysql 瑙﹀彂鍣ㄥ疄鐜扮骇鑱斿垹闄ゆ湁澶栭敭鐨勫寮犺〃

Android MVP + 娉涘瀷锛屽疄鐜颁簡鍙嬪ソVP浜や簰鍙夾ctivity娼滃湪鐨勫唴瀛樻硠闇茬殑浼樺寲

mysql浜嬪姟闅旂绾у埆