当前位置:网站首页>Bi-sql like

Bi-sql like

2022-06-25 01:12:00 Powerbi white tea

LIKE The operator

LIKE Operators belong to pairs WHERE Supplement to Clause . Usually we use WHERE Clauses know the specific filter conditions , But sometimes , Fuzzy query is also required , This situation requires LIKE.

Horizontal contrast , stay PowerBI Use in SEARCH Functions plus wildcards can achieve similar results .

Portal :

《SQL 丨 WHERE Clause 》

《PowerBI 丨 SEARCH》

Basic grammar

SELECT  Column name (*) FROM  The name of the table  WHERE  Column name  LIKE  Conditions 

matters needing attention

SQL The wildcard in is :%

PowerBI The wildcard in is :? or *

Using examples

Case data :

In the database of white tea machine , There is a name “TEST” The database of , There is a name “ Product list ” Case data for .

Example 1:

stay PowerBI in , Filter out... In the product table [ Name of commodity ] contain “ child ” All information of the word .

SELECT * FROM  Product list  WHERE  Name of commodity  LIKE N'% child %'

give the result as follows :

Example 2:

stay PowerBI in , Filter out... In the product table [ Name of commodity ] contain “ shoes ” All the information about .

SELECT * FROM  Product list  WHERE  Name of commodity  LIKE N'% shoes '

give the result as follows :

Example 3:

stay PowerBI in , Filter out... In the product table [ Item number ] With “2” All the information at the beginning .

SELECT * FROM  Product list  WHERE  Item number  LIKE '2%'

give the result as follows :

Example 4:

stay PowerBI in , Filter out... In the product table [ Classification of goods ] It doesn't contain “ Babies ” All the information about .

SELECT * FROM  Product list  WHERE  Classification of goods  NOT LIKE N'% Infant %'

give the result as follows :

This is white tea , One PowerBI Beginners .

原网站

版权声明
本文为[Powerbi white tea]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202210542594231.html