## Posts

Showing posts with the label Regular Expression

### 5 SQL Queries That Popularly Used in Data Analysis

Here are five popular SQL queries frequently used in data analysis. 1. SELECT with Aggregations Summarize data by calculating aggregates like counts, sums, averages, etc. SELECT department, COUNT(*) as employee_count, AVG(salary) as average_salary FROM employees GROUP BY department; 2. JOIN Operations  Combine data from multiple tables based on a related column. SELECT e.employee_id, e.name, d.department_name FROM employees e JOIN departments d ON e.department_id = d.department_id; 3. WHERE Clause for Filtering Filter records based on specified conditions. SELECT * FROM sales WHERE sale_date BETWEEN '2024-01-01' AND '2024-12-31'   AND amount > 1000; 4. ORDER BY Clause for Sorting Sort results in ascending or descending order based on one or more columns. SELECT product_name, price FROM products ORDER BY price DESC; 5. GROUP BY with HAVING Clause Group records and apply conditions to the aggregated results. SELECT department, SUM(salary) as total_salaries FROM employ

# Python Regex: The 5 Exclusive Examples

Regular expressions (regex) are powerful tools for pattern matching and text manipulation in Python. Here are five Python regex examples with explanations: 01 Matching a Simple Pattern import re text = "Hello, World!" pattern = r"Hello" result = re.search(pattern, text) if result:     print("Pattern found:", result.group()) Output: Output: Pattern found: Hello This example searches for the pattern "Hello" in the text and prints it when found. 02 Matching Multiple Patterns import re text = "The quick brown fox jumps over the lazy dog." patterns = [r"fox", r"dog"] for pattern in patterns:     if re.search(pattern, text):         print(f"Pattern '{pattern}' found.") Output: Pattern 'fox' found. Pattern 'dog' found. It searches for both "fox" and "dog" patterns in the text and prints when they are found. 03 Matching Any Digit   import re text = "The price of the