Войти
  • 26043Просмотров
  • 5 лет назадОпубликованоBecoming a Data Scientist

How to use the DATE_TRUNC Function in SQL (vs. TO_CHAR)

In this tutorial, you'll learn how to use the DATE_TRUNC function in SQL to optimize queries using dates! Watch the TO_CHAR video: Queries: 1) Truncate for the day: SELECT date, DATE_TRUNC('day',date) FROM table 2) Do some truncated date math: SELECT DATE_TRUNC('day',date1)-DATE_TRUNC('day',date2) FROM table Get the Pagila Database: Support the Channel: 1) Subscribe: 2) DataCamp: 3) Udacity: