Overview

Course Overview β€” SQL Filtering & Search Commands Practice | DataSosi
Course Designer
Professor Mark Lokanan
Royal Roads University
Academic Director  ·  Canadian Institute of Artificial Intelligence (CiAI)
Architect of Next-Generation AI and Machine Learning Systems for Fraud Detection and Financial Crime Analytics
Course Overview · SQL Practice Series · Part 2

SQL Filtering & Search
Commands Practice

Precision SQL for real-world analytics — restricting output, identifying unique values, searching text patterns, and isolating records within ranges.

In real-world analytics, analysts rarely examine every record in a table. They use filtering and search commands to narrow databases down to exactly the data that answers the business question. Across six parts, you will master LIMIT, DISTINCT, LIKE, Wildcards, IN, and BETWEEN — the commands that turn raw tables into focused, actionable outputs. Every query comes with an AI prompt and a validated SQL answer, using the same tables from Part 1.
6 Parts
48 Practice Queries
Same Tables as Part 1
AI-Assisted Learning
Certificate of Completion

Course Learning Objectives

  • Restrict query output to a specified number of rows using LIMIT and combine it with ORDER BY for Top N reporting.
  • Remove duplicate values and identify unique business categories using DISTINCT.
  • Search text fields using patterns with LIKE — matching values that start with, end with, or contain specific text.
  • Build flexible text searches using SQL Wildcards — % for any-length sequences and _ for exactly one character.
  • Filter records matching any value in a list using IN, replacing multiple OR conditions with a single clean clause.
  • Isolate records within defined numeric and date ranges using BETWEEN, inclusive of both boundary values.
  • Use AI tools to generate, verify, and troubleshoot filtering and search SQL queries against real business questions.
Six parts — click any part to see its topics and practice focus.
Top N

Part 1 covers LIMIT — the command that caps query output at a fixed row count. Students learn to restrict output for dataset previews, combine LIMIT with ORDER BY for ranked Top N analysis, and understand the correct SQL clause order when multiple commands are combined.

Topic 1
Restricting Output

How LIMIT stops a query after a specified number of rows, regardless of table size.

Topic 2
Top N Analysis

Combining ORDER BY with LIMIT to retrieve top-performing records ranked by value.

Topic 3
Previewing Datasets

Using LIMIT as the standard first query on unfamiliar tables to inspect structure.

Topic 4
Combining LIMIT with ORDER BY

The correct clause order: SELECT → FROM → WHERE → ORDER BY → LIMIT.

  • Practice focus: retrieving focused subsets across users, transactions, products, orders, support tickets, subscriptions, and campaign events
  • 8 practice queries — each with an AI prompt and a validated SQL answer
Unique Values

Part 2 covers DISTINCT — the command for identifying unique values in a column. Students learn to remove duplicates, explore available business categories, and retrieve unique combinations across multiple columns. DISTINCT is the first-look tool every analyst uses before building targeted filters.

Topic 1
Identifying Unique Values

How DISTINCT collapses repeated values so each unique entry appears only once.

Topic 2
Removing Duplicates

Why DISTINCT is used on status, category, and type columns before writing filters.

Topic 3
Exploring Categories

Using DISTINCT to understand available product categories and business segments.

Topic 4
Unique Business Records

Applying DISTINCT to multiple columns to return unique row combinations.

  • Practice focus: identifying unique values across users, transactions, products, orders, subscriptions, support tickets, and sessions
  • 8 practice queries — each with an AI prompt and a validated SQL answer
Text Search

Part 3 covers LIKE — the pattern-matching command for text searches. Students learn to find values that start with, end with, or contain specific text, and apply LIKE to names, product descriptions, campaign titles, and status fields. LIKE is the SQL equivalent of a search bar.

Topic 1
Pattern Matching

How LIKE matches values based on a pattern rather than an exact value.

Topic 2
Searching Text Fields

Applying LIKE to names, categories, statuses, and business descriptions.

Topic 3
Partial Text Filtering

Using % to match text at the start, end, or anywhere inside a value.

Topic 4
Business Search Logic

Using LIKE when exact values are unknown β€” the flexible business search pattern.

  • Practice focus: searching users, products, campaigns, support tickets, and subscriptions using text patterns
  • 8 practice queries — each with an AI prompt and a validated SQL answer
Pattern Building

Part 4 goes deeper into wildcard usage inside LIKE patterns. Students master both SQL wildcards — % for any-length sequences and _ for exactly one character — and learn to combine them for advanced text searches when partial information is available.

Topic 1
The % Wildcard

Matching zero, one, or many characters at any position in a text value.

Topic 2
The _ Wildcard

Matching exactly one character — used for values with a known length or structure.

Topic 3
Flexible Text Searching

Building patterns that match values even when only partial information is known.

Topic 4
Advanced Pattern Matching

Combining % and _ in a single LIKE pattern for precise positional searches.

  • Practice focus: flexible text searches across users, products, campaigns, and support tickets using % and _ patterns
  • 8 practice queries — each with an AI prompt and a validated SQL answer
List Filtering

Part 5 covers IN — the list-based filtering command. Students learn to filter records matching any value in a specified list, replace chains of OR conditions with a single clean IN clause, and select specific business segments by category, status, or type.

Topic 1
Filtering Multiple Values

How IN returns any row matching at least one value in the provided list.

Topic 2
Replacing Multiple OR Conditions

IN vs OR — same results, cleaner code for filtering the same column.

Topic 3
List-Based Filtering

Selecting records from named business categories or status groups in one clause.

Topic 4
Business Category Selection

Using IN to isolate meaningful business segments for analysis and reporting.

  • Practice focus: filtering users, transactions, products, orders, subscriptions, support tickets, campaigns, and sessions by category and status
  • 8 practice queries — each with an AI prompt and a validated SQL answer
Range Filtering

Part 6 covers BETWEEN — the range-filtering command. Students learn to isolate records within numeric, financial, and date-based boundaries, understand that BETWEEN is always inclusive of both boundary values, and combine BETWEEN with ORDER BY for sorted, ranged business reports.

Topic 1
Numeric Ranges

Filtering prices, amounts, and other numeric values within a defined boundary.

Topic 2
Date Ranges

Isolating business activity within specific time windows using YYYY-MM-DD format.

Topic 3
Financial Thresholds

Identifying transactions and fees within defined financial ranges for reporting.

Topic 4
Range-Based Filtering

Combining BETWEEN with ORDER BY for sorted, range-filtered analytical output.

  • Practice focus: range-filtering products, transactions, orders, users, subscriptions, campaign events, and support tickets by value and date
  • 8 practice queries — each with an AI prompt and a validated SQL answer

Course at a Glance

Six parts · 48 practice queries · same tables as Part 1

PartCommandCore FocusPractice
Part 1LIMITRestricting output, Top N analysis, previewing datasets, combining with ORDER BY8 Queries
Part 2DISTINCTIdentifying unique values, removing duplicates, exploring categories8 Queries
Part 3LIKEPattern matching, text field searching, partial text filtering, business search logic8 Queries
Part 4Wildcards% (any characters), _ (one character), flexible and advanced pattern matching8 Queries
Part 5INFiltering multiple values, replacing OR conditions, list-based business category selection8 Queries
Part 6BETWEENNumeric ranges, date windows, financial thresholds, inclusive range-based filtering8 Queries
AI-Assisted SQL Learning

Every practice question in this course includes a business question, an AI prompt for ChatGPT or Copilot, the validated SQL answer, and guidance on interpreting the result. Students learn to prompt effectively, verify SQL correctness, troubleshoot filtering logic, and connect query output to real business decisions.

What You Leave With

Six filtering and search commands. Forty-eight practice queries. A complete SQL search toolkit.

LIMIT

The ability to cap query output for dataset previews and Top N business reports.

DISTINCT

Instant identification of unique business values, categories, and segment combinations.

LIKE

Flexible text search across any column β€” start with, end with, or contains patterns.

Wildcards

Advanced pattern building using % for any-length and _ for single-character positions.

IN

Clean list-based filtering for multi-value business category and status selection.

BETWEEN

Inclusive range filtering for numeric, financial, and date-based business boundaries.

AI-Assisted Workflow

The ability to prompt, verify, and troubleshoot AI-generated filtering SQL in a professional workflow.

Certificate

Certificate of Completion from the Canadian Institute of Artificial Intelligence (CiAI), powered by DataSoSi.