Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
SQL Server REGEX Complete Tutorial with Practice Exercises
Rating: 4.3 out of 5(15 ratings)
1,464 students

SQL Server REGEX Complete Tutorial with Practice Exercises

SQL Regular Expressions and Pattern Matching, Wildcards
Created byKriti Chauhan
Last updated 1/2024
English

What you'll learn

  • Learn SQL REGEX operations in SQL Server (match on single/multiple , alpha/numeric characters) , position specific matches
  • Understand different kinds of wildcards for Regular Expression.
  • Write SQL Queries for Pattern Matching.
  • Master Regex expressions with lots of Practice Exercises.

Course content

1 section9 lectures1h 0m total length
  • Introduction1:27

    This is a short introduction to the course and it also explains the meaning of the wildcards in SQL Regular Expressions.

  • SQL Regex Complete Tutorial with Practice Exercises33:41

    In this video, we will write regex expressions for several real-time scenarios.

  • SQL Queries Learned so far.1:44

    This is your reference for all the SQL Queries learned and practiced so far.

  • More Practice SQL Queries15:10

    This is another set of useful and practical SQL Regex queries.

  • This Quiz will trick you!0:57

    This SQL Quiz is really interesting. Do you know the right answer?

  • Test - Can you answer this Question now?0:09
  • SQL Server - REGEX Quiz
  • More SQL Functions for Pattern Matching0:13

    In this Lecture, we briefly introduce two more SQL functions that can be used for Pattern Matching in SQL Server.

  • Difference Between PATINDEX and CHARINDEX0:59
  • SQL - Pattern Matching with CHARINDEX - Case Scenario- Emails5:49

    In this lecture, we will write a Query to count the number of emails from the same domain.

Requirements

  • Basic SQL writing skills

Description

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

Who this course is for:

  • Beginner / Intermediate SQL Learners