DevPath · Learn to code ESPTEN

Sets and functions

Scalar and aggregate functions

Scalar functions

A scalar function transforms one value per row and returns another value.

Text strings

Function What it does
UPPER(s) / LOWER(s) converts to uppercase / lowercase
LENGTH(s) number of characters
SUBSTR(s, start, n) substring (the index starts at 1)
TRIM(s) removes leading and trailing spaces
`a
SELECT UPPER(name) || ' (' || category || ')' AS label
FROM products;

Numbers

SELECT name, ROUND(price, 0) AS rounded_price FROM products;

GROUP_CONCAT: aggregating text

GROUP_CONCAT is an aggregate function (like COUNT or SUM): it combines the values of a group into a single string, separated by commas (or by the separator you give as the second argument). It is used with GROUP BY:

SELECT category, GROUP_CONCAT(name) AS products
FROM products
GROUP BY category
ORDER BY category;

Date functions (mention)

SQLite has no dedicated "date" type: it stores dates as text ('2026-06-22') or numbers, and manipulates them with functions:

SELECT strftime('%Y-%m', date('now')) AS year_month;

Examples

A readable label per product

SELECT UPPER(name) || ' - ' || category AS label
FROM products
ORDER BY id;
Put this into practice

DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.

Start free in the app →
← Working with NULLView the module →