Text and dates
Clean text and work with dates without guessing the dialect.
What you will be able to do
- Transform text with SQL functions
- Extract parts of a date
- Spot dialect differences
Text and date functions differ between databases. Learn the concepts, then check the exact function names for your engine.
SELECT UPPER(substr(title, 1, 3)) AS code,
title,
length(title) AS chars,
replace(course_slug, '-', '_') AS key
FROM lessons
WHERE title LIKE '%form%';
SELECT date('now') AS today,
strftime('%Y-%m', 'now') AS month,
julianday('2026-10-27') - julianday('2026-10-01') AS days;| Task | SQLite | PostgreSQL |
|---|---|---|
| Length | length(text) | length(text) |
| Substring | substr(text, 1, 3) | substring(text from 1 for 3) |
| Uppercase | upper(text) | upper(text) |
| Today | date('now') | current_date |
| Extract year | strftime('%Y', date) | extract(year from date) |
Your turn
EasyUppercase titles with length
Return each lesson title in uppercase and its character count, longest first.
SQL · starter
SELECT
FROM lessonsCheck your understanding before moving on.
Knowledge checkQuestion 1
In SQLite, which function extracts the year from a date?
Select an answer to continue
Study tools
Make it yours.
Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.
Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign inFinished reading?
Lock in what you just learned.
0%
Mark this lesson complete to save your place and move one step closer to the certificate.