1.如果对字符串中下划线、百分号做匹配,可以使用ESCAPE关键字。
1
select
*
from
customers
2
where
customer_id
like
'
%a\_product%
'
escape
'
\
'
;
2.当 NOT IN处理一个包含NULL的列表时,不会返回任何结果。

2

1
select
*
from
customers
where
2
customer_id
not
in
(
2
,
3
,
5
,
null
);
3.在ORDER BY子句中,也可以按照第几列排序。1代表第一列,2代表第二列,以此类推

2

1
select
*
from
customers
order
by
1
;
4.
