[MYSQLAdvancedChallenge]フィルターと並べ替え

フィルタ(検索):

すべての列を取得します。

select * from tb;

特定の列を取得する

select 列名1,列名2,... from tb;

特定の列を取得してエイリアスを作成する

select  列1 as x,列2 as y,列3 as z from 

基準に基づいて特定の列を取得する

根据条件检索:
select  from tb where

列を取得して重複排除します。

select distinct 列名 from tb;

一般的な条件

論理的判断:


= > >= < <=  not and or like in 

のコレクション:


where xx in(A,B,C....)

ワイルドカード(のような):


%xxx:以xxx结尾
xxx%:以xxx开头
%xxx%:包含xxx
%xxx%yyy%:同时包含xxx和yyy,并且xxx在yyy之前

選別:

select from where
order by  xxx (desc);

where在order by之前

最初にAに従って並べ替え、Aが同じ場合は、Bに従って並べ替えます

order by A (DESC),
B(DESC);

文字列操作:

concat(a,b):连接ab
substring(a,start,length):截取a子串
upper(字符串):字符串大写

おすすめ

転載: blog.csdn.net/m0_52043808/article/details/124158841