Skip to content
Guest
Learn SQL · Course Syllabus Show lessons
Intermediate Queries · 7 min read · Beginner

String, Math & Date Functions

Clean text with LOWER(), TRIM(), and LENGTH(), round metrics with ROUND(), and format timestamps using SQLite date functions.

What you'll learn

  • Normalize and combine text using LOWER(), UPPER(), TRIM(), and ||
  • Extract year or month parts from ISO dates using strftime()

Real-world datasets are messy: inconsistent casing, trailing spaces, and raw ISO timestamps. Built-in SQL scalar functions let you normalize data right inside your query.

Fill-in-the-Blank Exercise

Normalize Email & Round Average

Trim whitespace, lowercase the email, and round the average to 1 decimal.

SELECT (TRIM(email)) AS clean_email,
     (AVG(score), 1) AS avg_score
FROM users;

Try It Yourself

SQLText Cleanup & Monthly Grouping
Query Result (In-Browser SQLite)

Click Run SQL to execute this query against a live in-browser SQLite database.

Check Your Understanding

Score: 0 / 1

1. Which function removes leading and trailing spaces from a SQL text column?

Study Workspace

Finished this lesson?

Your progress is saved locally in your browser, no account needed.

Search courses, lessons, and references

Type to search across all courses, lessons, and quick references.

Press Esc to close Powered by Pagefind