0% found this document useful (0 votes)
43 views12 pages

Query Structures Keyboard Querying Pattern Matching

Uploaded by

25 Mohd Salique
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views12 pages

Query Structures Keyboard Querying Pattern Matching

Uploaded by

25 Mohd Salique
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Query Structures, Keyboard-Based

Querying & Pattern Matching


• With Examples & Use Cases
Query Structures: Overview
• - Definition: Formal organization of a query for data retrieval.
• - Purpose: Specifies what data is needed & how to get it.
• - Components:
• • Syntax (rules)
• • Semantics (meaning)
• • Logical structure
• • Physical structure
Types of Query Structures
• - Flat – Simple keywords (e.g., 'sales report 2024')
• - Hierarchical – Tree-like (e.g., Company → Dept → Employee)
• - Graph-based – Relationships as nodes/edges (e.g., social network queries)
• - Boolean – AND, OR, NOT operators (e.g., 'AI' AND 'Education')
Example: SQL Query Structure
• SELECT Name, Salary
• FROM Employees
• WHERE Department = 'HR' AND Salary > 50000;

• - Retrieves Name & Salary of HR employees earning above 50K.


• Use Cases:
• • Business Intelligence reports
• • E-commerce filtering
• • Research databases
Keyboard-Based Querying:
Overview
• - Definition: Typing queries into a system to get results.
• - Types:
• 1. Command language (SQL, SPARQL)
• 2. Keyword search (Google, library catalogs)
• 3. Natural language queries ('Show me laptops under ₹50,000')
Advantages & Limitations
• Advantages:
• • Flexible & fast for skilled users
• • Allows complex conditions
• • Works without GUI

• Limitations:
• • Requires syntax knowledge for formal queries
• • Not intuitive for non-technical users
Keyboard Query Examples
• Keyword Search:
• laptop under 50000 with SSD

• SQL Command:
• SELECT *
• FROM Products
• WHERE Price < 50000 AND StorageType = 'SSD';

• Use Cases:
• • Database management
• • Search engines
• • Library systems
Pattern Matching: Overview
• - Definition: Finding strings/data that match a specific pattern.
• - Types:
• • Exact matching
• • Wildcard matching (LIKE in SQL)
• • Regex (regular expressions)
SQL Pattern Matching
• Wildcards:
• • % → Any sequence of characters
• • _ → Single character

• Example:
• SELECT Name
• FROM Customers
• WHERE Name LIKE 'A%';
• - Finds names starting with “A” (Ahmed, Anita).
Regex Pattern Matching
• Python Example:
• import re
• pattern = r"\b\d{3}-\d{2}-\d{4}\b"
• text = "My SSN is 123-45-6789."
• if [Link](pattern, text):
• print("Valid pattern found!")

• Use Cases:
• • Data validation (emails, phone numbers)
• • Fraud detection
• • DNA sequence analysis
Summary Table
• Feature | Query Structures | Keyboard Querying | Pattern Matching
• --------|------------------|-------------------|-----------------
• Definition | Query organization | Typing to search | Match by patterns
• Skill Needed | Medium–High | Low–High | Medium
• Example | SQL SELECT | Google search | SQL LIKE / Regex
• Use Cases | BI, research | Databases, search | Validation, fraud detection
Final Note
• - Query structures give a framework.
• - Keyboard queries are the interface.
• - Pattern matching is a filtering tool.
• - Together, they form the backbone of modern search & database systems.

You might also like