
This is a short introduction to the course and it also explains the meaning of the wildcards in SQL Regular Expressions.
In this video, we will write regex expressions for several real-time scenarios.
This is your reference for all the SQL Queries learned and practiced so far.
This is another set of useful and practical SQL Regex queries.
This SQL Quiz is really interesting. Do you know the right answer?
In this Lecture, we briefly introduce two more SQL functions that can be used for Pattern Matching in SQL Server.
In this lecture, we will write a Query to count the number of emails from the same domain.
In this course, we will learn about SQL REGEX operations in SQL Server database.
We will learn about pattern matching and how to use the wildcards.
We will learn how to use the following wildcards -
% - Any string of zero or more characters.
_ (underscore) Any single character.
[ ] Any single character within the specified range
[^] Any single character not within the specified range
All examples are base don the AdventureWorksLT database from Microsoft.
The table is SalesLt.Product.
You can download it from the Microsoft Website.
Select * from SalesLT.Product
Examples -
-- % - Any string of zero or more characters.
Example 1 - Name with 'Bike'
-- _ (underscore) Any single character.
Example 2 - Second character is 'R'
-- Third character is '-' and 4th character is 'U'
Check for Product Number pattern
Example 3 - Any 2 characters followed by '-' followed
Example 4 - by any 4 characters followed by '-' followed
Example 5 - by any single character - HL-U509-R
-- [ ] Any single character within the specified range
Example 6 - Above pattern with last char L or M
Example 7 - Above pattern with last char between L and S
Example 8 - Above pattern with last char between L and R
-- [^] Any single character not within the specified range
Example 9 - Above pattern with last char not between L and R
Example 10 - Product number not starting with F
Example 11 - Product number not starting with F or H
Example 12 - Product NUmber not starting between A to H.
Example 13 - Data(Size) is Only One Character and Value is from A to Z
Example 14 - Data(Size) is Two Characters and Values are from A to Z
Example 15 - Text(rowguid) Rows Starting with a Number
Example 16 - Find a Number Pattern -
-- Product Number with 4th and 5th chars as numbers
Example 17 - Number(List Price) with two decimal places ending in 2
-- Using the Not Character for Regex with T-SQL
Example 18 Product Number - after 1st hyphen has either numbers or special characters
Example 19 - Name has Only alphabetic characters
Example 20 - Name has No special characters