From the course: SQL for Data Analysis

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Working with dates

Working with dates - SQL Tutorial

From the course: SQL for Data Analysis

Working with dates

- Most database management systems will allow for many different data types for dates, so let's look at some different methods. In MySQL, you have DATE, DATETIME, TIMESTAMP, and YEAR. There are lots of different options. They may seem very similar, but there are some unique differences. In MySQL, the DATE datatype will store the value as YYYY-MM-DD. While the TIMESTAMP stores both the date and time that includes the hour, minute, and second of the time. With most business applications, the timestamp in SQL will be more than enough precision. Datatypes allow the database to have different levels of precision based on the needs of the application. Let's take a look at the order date. Let's open the SelectOrderDate.sql file. Date is in both the name of the field and the datatype, and sometimes that may be confusing. In practice, make sure that the fields used are not the same as keywords. In this instance, we use…

Contents