sql contains code example

Example 1: sql not contains

SELECT * FROM tbl WHERE tbl.col NOT LIKE '%text%';

Example 2: sql where contains

SELECT * FROM mytable
WHERE column1 LIKE '%word1%'
   OR column1 LIKE '%word2%'
   OR column1 LIKE '%word3%'

Example 3: t_sql contains

SELECT * FROM table WHERE Contains(Column, "test");

Example 4: sql where contains part of string

-- To find an exact string
SELECT * FROM [table] WHERE [field] LIKE '%stringtosearchfor%'.

Example 5: sql like

eturns true if the operand value matches a pattern.
Example: Returns true if the user’s first_name ends with ‘son’.
SELECT * FROM users
WHERE first_name LIKE '%son';

Example 6: sql doesn't contain

/*Return data with the exception of the identified values*/
SELECT COLUMN1, COLUMN2 ...
FROM SCHEMA_NAME.TABLE_NAME
WHERE NOT (COLUMN1 LIKE '%VALUE%');

Tags:

Sql Example