Reader small image

You're reading from  Data Wrangling with SQL

Product typeBook
Published inJul 2023
PublisherPackt
ISBN-139781837630028
Edition1st Edition
Right arrow
Authors (2):
Raghav Kandarpa
Raghav Kandarpa
author image
Raghav Kandarpa

Raghav Kandarpa is an experienced Data Scientist in Finance and logistics industry with expertise in SQL, Python, Building Machine Learning Models, Financial Data Modelling, and Statistical Analysis. He holds a Masters' degree in Business Analytics specializing in Data Science from the University of Texas at Dallas.
Read more about Raghav Kandarpa

Shivangi Saxena
Shivangi Saxena
author image
Shivangi Saxena

Shivangi Saxena is an experienced BI Engineer with proficiency in SQL, Data Visualization, and Statistical Analysis. She holds a master's degree in Information Technology and Management from the University of Texas at Dallas. She has several years of experience building several BI tools and products using SQL and BI reporting tools which has helped stakeholders to get visibility to the right data points
Read more about Shivangi Saxena

View More author details
Right arrow

SQL DATE data type functions

The DATE data type typically takes 4 bytes of storage in a database and can hold date values with a range of 1000-01-01 to 9999-12-31. The TIMESTAMP data type is similar to the DATE data type, but it also includes information about the time to a precision of one second. The format used to store timestamp values is typically YYYY-MM-DD HH:MM:SS.

There are several date functions provided by the SQL engine to manipulate the date and time information stored in date or DateTime columns. Let’s look at each of them in detail.

Figure 4.1 – DateTime functions

Figure 4.1 – DateTime functions

EXTRACT

The SQL EXTRACT function is used to extract a part of a date or a timestamp value. The function takes two arguments: the first is the part of the date or timestamp that you want to extract (such as the year, month, or day), and the second is the date or timestamp value that you want to extract from. The syntax for the EXTRACT function is as follows:

...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Data Wrangling with SQL
Published in: Jul 2023Publisher: PacktISBN-13: 9781837630028

Authors (2)

author image
Raghav Kandarpa

Raghav Kandarpa is an experienced Data Scientist in Finance and logistics industry with expertise in SQL, Python, Building Machine Learning Models, Financial Data Modelling, and Statistical Analysis. He holds a Masters' degree in Business Analytics specializing in Data Science from the University of Texas at Dallas.
Read more about Raghav Kandarpa

author image
Shivangi Saxena

Shivangi Saxena is an experienced BI Engineer with proficiency in SQL, Data Visualization, and Statistical Analysis. She holds a master's degree in Information Technology and Management from the University of Texas at Dallas. She has several years of experience building several BI tools and products using SQL and BI reporting tools which has helped stakeholders to get visibility to the right data points
Read more about Shivangi Saxena