|
Searches for a specified pattern in a column
Pesquisa um padrão especificado em uma coluna
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
|
The following SQL statement selects all customers with a CustomerName starting with "a":
A seguinte instrução SQL seleciona todos os clientes com um CustomerName começando com "a":
SELECT * FROM Customers
WHERE CustomerName LIKE 'a%';
|
The following SQL statement selects all customers with a CustomerName ending with "a":
A seguinte instrução SQL seleciona todos os clientes com um CustomerName terminando com "a":
SELECT * FROM Customers
WHERE CustomerName LIKE '%a';
|
The following SQL statement selects all customers with a CustomerName that have "or" in any position:
A seguinte instrução SQL seleciona todos os clientes com um CustomerName que têm "or" em qualquer posição:
SELECT * FROM Customers
WHERE CustomerName LIKE '%or%';
|
The following SQL statement selects all customers with a CustomerName that have "r" in the second position:
A seguinte instrução SQL seleciona todos os clientes com um CustomerName que têm "r" na segunda posição:
SELECT * FROM Customers
WHERE CustomerName LIKE '_r%';
|
The following SQL statement selects all customers with a CustomerName that starts with "a" and are at least 3 characters in length:
A seguinte instrução SQL seleciona todos os clientes com um CustomerName que começa com "a" e tem pelo menos 3 caracteres de comprimento:
SELECT * FROM Customers
WHERE CustomerName LIKE 'a__%';
|
The following SQL statement selects all customers with a ContactName that starts with "a" and ends with "o":
A seguinte instrução SQL seleciona todos os clientes com um ContactName que começa com "a" e termina com "o":
SELECT * FROM Customers
WHERE ContactName LIKE 'a%o';
|
The following SQL statement selects all customers with a CustomerName that does NOT start with "a":
A seguinte instrução SQL seleciona todos os clientes com um CustomerName que NÃO comece com "a":
SELECT * FROM Customers
WHERE CustomerName NOT LIKE 'a%'; |
Veja também:
|