SQL and databases

Stage 2 · Lesson 7 of 8

Text and date functions in your dialect

Querying one table

Built-in clean up and reshape values. They join pieces of text, trim spaces, change upper and lower case, pull out parts of a date, add time periods and round timestamps down to the day or month. This is where the three databases differ most.

joins strings with || and has date_trunc and . MySQL uses CONCAT, DATE_FORMAT and INTERVAL 30 DAY. uses CONCAT or +, DATEADD, DATEDIFF and DATETRUNC.

Learn the ten functions you will use daily in your own database, and know where the documentation lists the rest. They come up constantly in reports and whenever you month.

Common trapwrapping an indexed column in a function inside WHERE, which usually stops the index being used, as the performance stage shows.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

  • CoursePaid
    Grokking SQL for Tech Interviews

    Design Gurus · Intermediate · Subscription

    The basics, order of execution and functions chapters, each followed by graded problems

  • CourseFree
    SQLBolt

    SQLBolt · Beginner

    Free: Lessons 1 to 4, 8, 9 and 12 cover SELECT, filtering, sorting, NULLs, expressions and query order

Practise

Keep handy

  • The T-SQL SELECT, TOP and ORDER BY pages and the date and time functions list

  • Its SQL pages give quick examples and note where MySQL and SQL Server syntax differ

Also worth your time

Mark this stage as not done?