From the course: Complete Guide to Analytics Engineering

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

SQL date functions

SQL date functions

- [Instructor] The majority of data sets we work with as an analytics engineer have a date field of some type in the table. That's how we often collect data. We measure events over time. As such, getting familiar with the functions that allow you to alter or compare date and time fields is very important. There will be times your date fields come through as the wrong data type and you'll need to transform them. Other times, you'll need to remove a time from a date time field, or you'll need to adjust the time zone on a date field or find the numerical difference between two dates. In this video, we'll cover the most common date functions and why we use them. First, let's start by doing a similar function we did in Python, but with SQL instead. You'll remember that our sales table that hadn't been cleaned yet had a field that was not a date field, but a text field. Let's confirm with a quick query that the columns of our table are the correct data types. In SQLite, you can run PRAGMA…

Contents