# Date, Number, and String Functions

Use built-in date, number, and string functions to transform table data.

StartDate, Number, and String Functions

Lesson 1 of 1

- 1Oftentimes, data in columns of tables is not in the exact format we need to complete our desired analysis. We may need to extract a date from a full timestamp, manipulate a number, or combine first…
- 2We’ll begin with dates. Dates are often written in the following format 1. Date: YYYY-MM-DD 2. Datetime or Timestamp: YYYY-MM-DD hh:mm:ss We can use SQL’s date functions to transform …
- 3Nice work! Now let’s assume that we have a column in our baked_goods table named manufacture_time in the format YYYY-MM-DD hh:mm:ss. We’d like to know the number of baked_goods manufactured by da…
- 4Given a datepart and a column of date or timestamp data type, we can increment date or timestamp values by a specified interval. For example, in SQLite, the statement DATETIME(time1, ‘+3 hours’,…
- 5Great work! Numeric functions can be used to transform numbers. Some common SQLite mathematical functions are included below that take numeric data types as inputs: - SELECT (number1 + number2);:…
- 6A couple more useful numeric SQL functions are included below: MAX and MIN. MAX(n1,n2,n3,…): returns the greatest value in the set of the input numeric expressions MIN(n1,n2,n3,…): returns th…
- 7String manipulation can be useful to derive information from columns. We’ll cover a couple of the common string functions here. A common use case for string manipulation in SQL is concatenation o…
- 8Another useful string function in SQL is REPLACE(): REPLACE(string,from_string,to_string) The function returns the string string with all occurrences of the string from_string replaced by the st…
- 9Congratulations! You just learned about date, number, and string functions in SQL. What can we generalize so far? Date Functions: * DATETIME; Returns the date and time of the column specified. T…