SQL LESSON 21 OF 32

Text & dates in SQLite

LOWER and UPPER change text case; LENGTH counts characters. SQLite stores date-like values as text, real or integer formats, not a dedicated date type. ISO YYYY-MM-DD text sorts by calendar date. Functions differ across SQL dialects.

हिन्दी में समझें

LOWER/UPPER अक्षर केस, LENGTH लंबाई देता है। SQLite का अलग date प्रकार नहीं है। YYYY-MM-DD टेक्स्ट कैलेंडर के क्रम में छँटता है। फ़ंक्शन डेटाबेस अनुसार बदलते हैं।

अभ्यास: YYYY-MM के month और COUNT(*) AS total, महीने अनुसार समूह और क्रम।

Hinglish mein samjhein

LOWER/UPPER case aur LENGTH characters deta hai. SQLite ka dedicated date type nahi. YYYY-MM-DD text calendar order mein sort hota hai. Date functions dialect-specific hain.

Practice: YYYY-MM month aur order COUNT(*) AS total, month group aur sorted.

A small SQL example

SELECT id, strftime('%Y-%m',order_date) AS month FROM orders ORDER BY id;

Examples use the fictional shop database bundled with the SQL playground: customers, products, orders, order_items and employees. The engine is SQLite; other SQL dialects may differ.

Try this example in the SQL playground →

Practise this idea

Return month and order count as total, grouped and ordered by YYYY-MM month.

Check answer & explanation
SELECT strftime('%Y-%m',order_date) AS month,COUNT(*) AS total FROM orders GROUP BY strftime('%Y-%m',order_date) ORDER BY month;

strftime('%Y-%m', order_date) extracts the month in SQLite. Grouping by that expression gives one order count per month.

Stuck in the course? Choose Check answer for either the challenge or quiz. Read the explanation and continue to the next lesson at your own pace.

Check your understanding

Portable date functions are…

  1. Identical everywhere
  2. Dialect-dependent
  3. Always unavailable
Check the quiz answer

Dialect-dependent

LOWER and UPPER change text case; LENGTH counts characters. SQLite stores date-like values as text, real or integer formats, not a dedicated date type. ISO YYYY-MM-DD text sorts by calendar date. Functions differ across SQL dialects.

References & corrections

Use the official SQLite documentation for full language rules. Read how these lessons are made and checked. Found a mistake? Report it to Excel Keys with this lesson URL and a reproducible example.

FROM LEARNING TO BUSINESS RESULTS

Need a dashboard for your team?

Excel Keys designs custom Excel and HTML dashboards around your own KPIs and Excel files. They run offline in the browser, so your data stays on your computer.