Skip to content

DB/SQL

Data modeling, SQL and NoSQL, transactions, indexes, integrity, and migrations.

Articles

18 total

SQL WHERE vs. HAVING: Filter Paid Orders Before COUNT(*)

Find customers with at least two paid orders by filtering input rows with WHERE and grouped counts with HAVING.

DB/SQL2 min

SQL LIKE % vs. _: Search for a Literal Underscore with ESCAPE

See why LIKE task_% also matches taskA01, then use ESCAPE to search for codes beginning with a real underscore.

DB/SQL3 min

SQL UPDATE without WHERE: Check affected rows and ROLLBACK before COMMIT

A missing WHERE updates every row. Use three SQLite rows to inspect the scope, roll back before commit, and retry with a targeted condition.

DB/SQL2 min

SQL DEFAULT vs. NOT NULL: What Happens When an INSERT Omits a Column?

Distinguish an omitted column from an explicit NULL and design a safe initial value with DEFAULT and a NOT NULL constraint.

DB/SQL3 min

Why SQL WHERE column = NULL Returns No Rows: Use IS NULL

Use four sample tasks to understand UNKNOWN comparisons, IS NULL, IS NOT NULL, and a safe check before updating rows.

DB/SQL3 min

SQL WHERE with AND and OR: use parentheses to exclude canceled orders

Compare ungrouped AND/OR conditions, parentheses, and IN against six orders to see why a canceled row passes the filter.

DB/SQL2 min

SQL COUNT(*) vs. COUNT(column): Why Does NULL Reduce the Count?

Using four jobs, see why COUNT(*) returns 4 but COUNT(retry_count) returns 3, how NULL differs from zero, and what changes after a WHERE filter.

DB/SQL2 min

SQL INSERT, COMMIT, and ROLLBACK: What a Transaction Can Undo

Understand the boundary between an uncommitted INSERT, COMMIT, and ROLLBACK while handling test data safely.

DB/SQL3 min