FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

25 snippets foundClear filters
SQLiteGetting Started

Accept either of two conditions

SQLite: Use OR to keep matching names or out-of-stock rows.

SQLite✓ Tested
SQLiteGetting Started

Add values across several rows

SQLite: Use SUM to calculate a total quantity.

SQLite✓ Tested
SQLiteGetting Started

Calculate a total for each group

SQLite: Group nonmissing categories and calculate separate totals.

SQLite✓ Tested
SQLiteGetting Started

Calculate a value with SELECT

SQLite: Evaluate a small arithmetic expression on the database server.

SQLite✓ Tested
SQLiteGetting Started

Count the rows in a table

SQLite: COUNT(*) includes every row, including rows with NULL columns.

SQLite✓ Tested
SQLiteGetting Started

Create a table and insert its first row

SQLite: Define column types and a primary key, then insert one row using an explicit column list.

SQLite✓ Tested
SQLiteGetting Started

Delete one row from a practice table

SQLite: Restrict DELETE with a primary-key condition and verify the remaining row count.

SQLite✓ Tested
SQLiteGetting Started

Display a fallback for missing data

SQLite: Return a supplied label when a column contains NULL.

SQLite✓ Tested
SQLiteGetting Started

Filter by a numeric comparison

SQLite: Keep rows whose quantity exceeds a chosen threshold.

SQLite✓ Tested
SQLiteGetting Started

Filter groups after aggregation

SQLite: Use HAVING to test a group’s calculated total.

SQLite✓ Tested
SQLiteGetting Started

Find missing values with IS NULL

SQLite: Use IS NULL rather than equality to test for missing data.

SQLite✓ Tested
SQLiteGetting Started

Give a result column a readable name

SQLite: Use AS to label a computed result column.

SQLite✓ Tested