|
所在平台: Udemy |
课程主页: https://www.udemy.com/course/sql-server-regex-complete-tutorial-with-practice-exercises/
课程评论:没有评论
SQL Server REGEX 完整教程(含实操练习) 本课程将深入探讨 SQL Server 数据库中的正则表达式(REGEX)操作。 **核心内容:** * **模式匹配:** 学习如何使用正则表达式来匹配字符串中的特定模式。 * **通配符详解:** 掌握以下 SQL Server 中常用的正则表达式通配符: * `%`:匹配零个或多个任意字符。 * `_`(下划线):匹配任意单个字符。 * `[]`:匹配方括号内指定的任意单个字符。 * `[^]`:匹配方括号内指定范围之外的任意单个字符。 **实践环境:** 所有示例均基于 Microsoft 的 AdventureWorksLT 数据库。 主要练习表为 `SalesLt.Product`。 **课程示例(基于 `SalesLt.Product` 表):** * **通配符 `%` 示例 1:** 查找名称中包含 "Bike" 的产品。 * **通配符 `_` 示例 2:** 查找第二个字符为 'R' 的产品。 * **产品编号模式检查:** * 示例 3:查找以任意两个字符后跟 '-' 开头的产品。 * 示例 4:查找以任意四个字符后跟 '-' 开头的产品。 * 示例 5:查找以任意单个字符开头的产品。 * 示例 6:查找产品编号模式为 HL-U509-R- 且最后一个字符是 L 或 M 的产品。 * **通配符 `[]` 示例:** * 示例 7:查找产品编号模式中最后一个字符在 L 到 S 范围内的产品。 * 示例 8:查找产品编号模式中最后一个字符在 L 到 R 范围内的产品。 * **通配符 `[^]` 示例:** * 示例 9:查找产品编号模式中最后一个字符不在 L 到 R 范围内的产品。 * 示例 10:查找产品编号不以 'F' 开头的产品。 * 示例 11:查找产品编号不以 'F' 或 'H' 开头的产品。 * 示例 12:查找产品编号不以 A 到 H 范围内的字符开头的产品。 * **字符范围与长度示例:** * 示例 13:查找 Size 列只有一个字符且该字符是 A 到 Z 中的任意一个的产品。 * 示例 14:查找 Size 列是两个字符,且这两个字符都是 A 到 Z 中的任意一个的产品。 * **特定字符模式示例:** * 示例 15:查找 rowguid 列以数字开头的产品。 * 示例 16:查找产品编号的第 4 位和第 5 位是数字的产品。 * 示例 17:查找 List Price(价格)为两位小数且以 2 结尾的产品。 * **结合 NOT 使用 Regex 示例:** * 示例 18:使用 `NOT` 关键词查找产品编号在第一个连字符后包含数字或特殊字符的产品。 * **纯字母和无特殊字符示例:** * 示例 19:查找 Name 列只包含字母字符的产品。 * 示例 20:查找 Name 列不包含任何特殊字符的产品。 本课程将帮助您熟练运用 SQL Server 的正则表达式功能,高效地处理和查询数据。
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 rangeAll 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.ProductExamples - - % - 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 HExample 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 charactersExample 19 - Name has Only alphabetic characters Example 20 - Name has No special characters