By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .
close

Code snippets for various programming languages/frameworks.

rss_feed Subscribe RSS

This code snippet shows how to calculate time differences.

DATEDIFF function is not implemented in Teradata. Thus we need to use other approach to calculate time difference.

Code snippet

-- for calculate days difference, we can directly use minus (-) operator
SELECT DATE'2019-07-16' - DATE'2019-06-01' AS Diff_Days;

-- month different
SELECT (DATE'2019-07-16' - DATE'2019-06-01') MONTH(4) AS Diff_Months;
info Last modified by Raymond at 7 months ago

info About author

info License/Terms

More from Kontext

local_offer teradata local_offer spark local_offer pyspark

visibility 1740
thumb_up 0
access_time 8 months ago

In my article Connect to Teradata database through Python , I demonstrated about how to use Teradata python package or Teradata ODBC driver to connect to Teradata. In this article, I’m going to...

open_in_new View

local_offer teradata local_offer SQL

visibility 57
thumb_up 0
access_time 4 months ago

JSON is commonly used in modern applications for data storage and transfers. Pretty much all programming languages provide APIs to parse JSON. 

open_in_new View

local_offer SQL local_offer hive

visibility 63
thumb_up 0
access_time 4 months ago

In Oracle database, you can select from dual table if you only want to return a one row result set. In many other databases, the query engine supports select directly from constant values without specifying a table name. 

open_in_new View

local_offer SQL local_offer hive

visibility 263
thumb_up 0
access_time 4 months ago

In different databases, the syntax of selecting top N records are slightly different. They may also differ from ISO standards.

open_in_new View

info Follow us on Twitter to get the latest article updates. Follow us