SQL學習筆記 查詢匹配

2021-09-13 10:45:07 字數 397 閱讀 8492

sql查詢匹配下劃線(_)或百分號(%)

select * from dataobject_library where colname like '%/_%' escape '/';

select * from dataobject_library where colname like '%/%%' escape '/';

mysql裡用\_、\%,如

select * from 表名 where 欄位名 like '%\_%';

select * from 表名 where 欄位名 like '%\%%';

注:在like後面的模糊搜尋字串中的百分號%之前使用轉義字元,比如\或/,

再用escape制定該轉義字元,例如:like 'abc\%ef' escape '\'

sql 正則匹配查詢

替換非數字文字 moblidesearch preg replace 0 9 search stingsearch for number search string 乙個陣列,再用 digit implode 分開 stingsearch implode digit str split moblid...

SQL語句匹配查詢

僅查詢純數字 匹配查詢 僅sql有效 select cast spxx.id as int from spxx,lb where spxx.lbid lb.id and patindex 0 9 spxx.id 0 and len ltrim rtrim spxx.id 10 access sql都...

SQL學習筆記 多表查詢

溫故而知新。多表查詢 內連線 外連線和交叉連線 1 左外連 sql select from table1left jointable2ontable1.條件列名 table2.條件列名 注 table1表資訊全部顯示,符合條件的 table2 都會與 table1 對齊,不符合條件的 table2 ...