Orkun Tahir Aran, PhD Profile picture
Associate Prof. in Health Sciences | Data Analyst & Scientist | Freelancer | Open to Work

Jun 20, 2022, 8 tweets

Let's continue with Temporal data, earlier we read strings and numeric data.

1. The major problem with dates is time zones, GMT , UTC. SQL server uses UTC.

2. There are various date data types in Sql;
DATE YY-MM-DD
DATETIME YY-MM-DD HH:MI:SS
TIMESTAMP same as datetime

Enter your dates as strings such as;

3. String to date conversion
Is easy with CAST()

4. Functions to generate date
STR_TO_DATE() function decides data type depending on your input

The second part of the function is datetime shortcuts, to learn more about %M type inputs please see
dev.mysql.com/doc/refman/5.6…

5. Adding date

6. Selecting parts from a date is easy, and #MySql has many different functions such as DAYNAME(), DAYOFMONTH(). It is easier to use EXTRACT() rather than remembering all functions :)

That's all for today, for the next thread we will cover groupings.

Have a nice day, see you around.

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling