The following formula is used for the conditions after WHERE:
As an example, there is no explanation for the SELECT statement, so I don't know the meaning of the expression and how to interpret it in the SELECT statement and how to interpret it.
LIKE "_Vegetable %"
(Meaning) A string containing "vegetables"._ is a single character, % is an arbitrary character wildcard
What do you mean?
sql
Like is used to search for patterns in a string, such as column name like 'pattern character'
.
_
is any single character and %
is any string of "0 or more characters", so 'like'_vegetable%' searches for one character before 'vegetable', and 'vegetable' after 'vegetable'.
create table test1(
comment varchar(255)
);
insert into test1 values('I love vegetables');
insert into test1 values('I love hot vegetables');
insert into test 1 values ('hot vegetables');
insert into test 1 values ('I love pesticide-free vegetables');
select * from test1 where comment like '_vegetable %';
Run Results
I love hot vegetables
hot vegetable
http://sqlfiddle.com/#!9/184e0/1
_ and % are wildcards.
Since _ represents any single character, LIKE "_vegetables"
includes
vegetables, raw vegetables, etc.
% represents any string of at least 0 characters, and LIKE "vegetable %"
is affected by such things as "vegetable" or "vegetable juice."
https://technet.microsoft.com/ja-jp/library/ms187489(v=sql.105).aspx
Is there a use case?
SELECT* FROM tblName WHERE fieldName LIKE'_Vegetable %'
SELECT [Field you want to display]
FROM [Table Name]
WHERE [Field to be searched] LIKE '[Search Pattern]'
[Search Patterns] can use wildcards.
The wildcard is described by someone else, so please refer to it for more information.
© 2024 OneMinuteCode. All rights reserved.