SQL LIKE and Not LIKE Operator for Data Analysis
Автор: SlideScope
Загружено: 2025-05-27
Просмотров: 50
Описание:
#sql #filter #sqllike
Sample queries used in today's lecture
-- LIKE Operator --
% _ ( underscore )
% means any number of characters
_ means only one character
1. Contains
2. Startswith
3. Endswith
We want to find all data of those customers who are from city which has a name starting with L
We want to find all data of those customers who are from city which has a name ending with L
---- contains "on" in the name
-- LIKE Operator -- Pattern Matching
SELECT ContactName, City FROM customers WHERE City LIKE 'L%'; -- startswith
-- LIKE Operator -- Pattern Matching
SELECT ContactName, City FROM customers WHERE City LIKE '%L' -- endsswith
-- LIKE Operator -- Pattern Matching
SELECT ContactName, City FROM customers WHERE City LIKE '%on%' -- contains
-- underscore
-- a city we dont know the first letter second and third are o and n resp. fourth is not known 5th is r and then there can n number of characters
_on_r%
-- city - we dont know the first letter second and third are o and n resp.
_on%
SELECT ContactName, City FROM customers WHERE City LIKE '%o__n%';
SELECT ContactName, City FROM customers WHERE City LIKE '%L%' ORDER BY ContactName;
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: