From the course: Complete Guide to SQL for Data Engineering: from Beginner to Advanced

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Working with date functions

Working with date functions

- [Instructor] You have understood the different mathematical functions. Now imagine if you want to manipulate different dates in your database or want to know today's date, extract a specific portion of the date, or you want to do some additional subtraction in the date. Then there is a lot of built-in functions available for this purpose. Let's go down to PG admin and see how we can play with this date. To get the current date, there is a function called current date. You can say select current_date. This function will give you the current date. Now maybe possible that from a date column you have, you want to extract some specific month, year, or day from this date. So to extract a specific piece out of this date, there is a function exists. The function is called extract. You use extract and you tell the extract what you want to extract out of it. For example, you want to extract day from your current date. When…

Contents