sqlite
Database; use; embedded relational database
like
英[laɪk] 美[laɪk ]
vt. Like; (used with would or should to express politeness) think; want; like to do
prep. (express attribute) like; (expression method) like; (ask for opinions )...how; (indicating enumeration) such as
adj. similar; identical
n. similar people [things]; preferences; hobbies; (especially those who are regarded as having no Someone or something is so good) kind, type
conj.as;as if;like...the same;as if
adv.such as;(informal spoken language, replacing as)the same as... ; (informal spoken language, used when thinking about the next sentence, explanation or example) probably; maybe
SQLite Like function syntax
Function:SQLite's LIKE operator is used to match the text value of the wildcard specified pattern. The LIKE operator returns true, which is 1, if the search expression matches the pattern expression. There are two wildcard characters used with the LIKE operator: The percent sign (%) The underscore (_) The percent sign (%) represents zero, one, or more numbers or characters. An underscore (_) represents a single number or character. These symbols can be used in combination.
Syntax: % and _ The basic syntax is as follows:
SELECT FROM table_name
WHERE column LIKE 'XXXX%'
or
SELECT FROM table_name
WHERE column LIKE '%XXXX%'
or
SELECT FROM table_name
WHERE column LIKE 'XXXX_'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX'
or
SELECT FROM table_name
WHERE column LIKE '_XXXX_'
You can use the AND or OR operator to combine N quantities of conditions. Here, XXXX can be any number or string value.
SQLite Like function example
COMPANY 表有以下记录: ID NAME AGE ADDRESS SALARY ---------- ---------- ---------- ---------- ---------- 1 Paul 32 California 20000.0 2 Allen 25 Texas 15000.0 3 Teddy 23 Norway 20000.0 4 Mark 25 Rich-Mond 65000.0 5 David 27 Texas 85000.0 6 Kim 22 South-Hall 45000.0 7 James 24 Houston 10000.0 sqlite> SELECT * FROM COMPANY WHERE AGE LIKE '2%'; 这将产生以下结果: ID NAME AGE ADDRESS SALARY ---------- ---------- ---------- ---------- ---------- 2 Allen 25 Texas 15000.0 3 Teddy 23 Norway 20000.0 4 Mark 25 Rich-Mond 65000.0 5 David 27 Texas 85000.0 6 Kim 22 South-Hall 45000.0 7 James 24 Houston 10000.0 sqlite> SELECT * FROM COMPANY WHERE ADDRESS LIKE '%-%'; 这将产生以下结果: ID NAME AGE ADDRESS SALARY ---------- ---------- ---------- ---------- ---------- 4 Mark 25 Rich-Mond 65000.0 6 Kim 22 South-Hall 45000.0