HexLibraryHexLibrary
</> HexCodeSign inSign up
PythonJavaScriptTypeScriptCC++JavaPHPGoRustRubyBashSQLLuaPerlCOBOLPascalDelphiFortranDartSwiftC#JuliaGroovyRElixirHaskellKotlinScalaClassic ASPClipperMS-DOS
LESSONS
Introduction to SQL (SELECT)Tables (CREATE & INSERT)Filtering (WHERE)Sorting & LimitingAggregate FunctionsUpdate & DeleteJoins (JOIN)
REFERENCE
📖 Overview
🔎 Querying (SELECT)
🗃️ Creating a Table
✏️ Inserting & Modifying Data
🧲 Filtering (WHERE)
WHERELIKEIN / BETWEEN
🔢 Sorting & Limiting
📊 Aggregate Functions
🔗 Joins (JOIN)
SQL›REFERENCE›Filtering (WHERE)
🧲

Filtering (WHERE)

Selecting rows based on a condition.

CommandDescription
WHERERetrieves rows that match the condition.
LIKESearches text with a pattern.
IN / BETWEENIs it in a list or range?

WHERE

Try it yourself →

Retrieves rows that match the condition.

Syntax

SELECT ... WHERE condition;

Description

Write conditions using = != < > <= >= operators and AND/OR.

Example

CREATE TABLE k(name TEXT, age INTEGER);
INSERT INTO k VALUES ('Alex', 36), ('Sam', 20);
SELECT name FROM k WHERE age >= 30;

Expected output

Alex

When to use?

Fetching specific records.

LIKE

Try it yourself →

Searches text with a pattern.

Syntax

WHERE column LIKE pattern;

Description

% for any number of characters, _ for a single character. 'A%' for those starting with A.

Example

CREATE TABLE k(name TEXT);
INSERT INTO k VALUES ('Alex'), ('Ava'), ('Sam');
SELECT name FROM k WHERE name LIKE 'A%' ORDER BY name;

Expected output

Alex
Ava

When to use?

Text search (starts with/ends with/contains).

IN / BETWEEN

Try it yourself →

Is it in a list or range?

Syntax

WHERE column IN (a, b);

Description

IN checks if it is one of specific values; BETWEEN checks if it is within a and b.

Example

CREATE TABLE k(age INTEGER);
INSERT INTO k VALUES (18), (25), (40);
SELECT COUNT(*) FROM k WHERE age BETWEEN 18 AND 30;

Expected output

2

When to use?

Multiple value / range filter.

HexLibraryHexLibrary

Learn programming more clearly. Every command is explained line by line with colors, reinforced with runnable exercises, test your code instantly — all in one place, free.

Learn

  • Home
  • Languages & Lessons
  • HexCode

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Use

Other Projects

  • HexToolz
  • Free Service Manuals
© 2026 HexLibrary · The clearest way to learn code