Search
 
SCRIPT & CODE EXAMPLE
 

SQL

wildcard in sql

SELECT * FROM table_name WHERE UPPER(col_name) LIKE '%SEARCHED%';
SELECT * FROM table_name WHERE col_name LIKE '%Searched%';  -- Case sensitive

SYMBOL	DESCRIPTION	(SQL)                       EXAMPLE
%	    zero or more characters	                bl%      'bl, black, blue, blob'
_	    a single character	                    h_t      'hot, hat, hit'
[]	    any single character within brackets	h[oa]t   'hot, hat', but NOT 'hit'
^	    any character not in the brackets	    h[^oa]t  'hit', but NOT 'hot, hat'
-	    a range of characters	                c[a-b]t   'cat, cbt'
Comment

sql wildcard characters

% -- Equates to zero or more characters.
-- Example: Find all customers with surnames ending in ‘ory’.
SELECT * FROM customers
WHERE surname LIKE '%ory';

_ -- Equates to any single character.
-- Example: Find all customers living in cities beginning with any 3 characters, followed by ‘vale’.
SELECT * FROM customers
WHERE city LIKE '_ _ _vale';

[charlist] -- Equates to any single character in the list.
-- Example: Find all customers with first names beginning with J, K or T.
SELECT * FROM customers
WHERE first_name LIKE '[jkt]%';
Comment

_ Wildcard in SQL

SELECT *
FROM Customers
WHERE country LIKE 'U_';
Comment

[] Wildcard in SQL

SELECT *
FROM Customers
WHERE country LIKE 'U[KA]%';
Comment

! Wildcard in SQL

SELECT *
FROM Customers
WHERE last_name LIKE '[!DR]%';
Comment

SQL Wildcards

SELECT *
FROM Customers
WHERE last_name LIKE 'R%';
Comment

PREVIOUS NEXT
Code Example
Sql :: check if sql is installed 
Sql :: sql server insert into select 
Sql :: import all databases mysql 
Sql :: how to combine first and last nae into one columb sql 
Sql :: space not removing from column in sql 
Sql :: mysql select into new table 
Sql :: t-sql drop function if exists 
Sql :: sql select duplicates based on two columns 
Sql :: sql convert varchar to date 
Sql :: update table disable constraint 
Sql :: add column postgres with default value 
Sql :: varchar vs nvarchar sql 
Sql :: how to put value in variable mysql 
Sql :: sql server datetime to string 
Sql :: incompatible sql_mode=only_full_group_by 
Sql :: The local psql command could not be located 
Sql :: delete database mysql command 
Sql :: sql command to show all tables 
Sql :: mysql get all tables from a specific database 
Sql :: postgresql subtract date/hours 
Sql :: sql server add time to date 
Sql :: alter table add check constraint oracle 
Sql :: raiserror nowait sql server 
Sql :: como consultar registros duplicados en mysql 
Sql :: insert snowflake 
Sql :: get yesterday date ISO in psql 
Sql :: WHERE not regex in SQL 
Sql :: influxdb list all tags for a measurement 
Sql :: postgresql full text search 
Sql :: install latest mysql 8 linux server 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =