-
Notifications
You must be signed in to change notification settings - Fork 0
/
Teradata Coding Sample.RMD
21 lines (18 loc) · 1.19 KB
/
Teradata Coding Sample.RMD
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
---
title: "Teradata query samples"
author: "A.C. Brice"
date: "Monday, May 25, 2015"
---
I have to say I was not impressed with [Teradata syntax](http://www.info.teradata.com/htmlpubs/DB_TTU_13_10/index.html#page/SQL_Reference/B035_1141_109A/ch02.04.01.html). The query syntax was very familiar, but of course, Of Course, **Of Course**, they had to mess with date syntax. Everyone does. It's what really differentiates one query language from another (insert rude snort here). I continued to run into things like no REGEXP support, much less, LEAD or LAG function support. So, it's mostly what Teradata CAN'T do that I could speak to.
Mostly, I just pulled the data into a SQL Server database for reporting. But, as you can see, Teradata SQL below is nothing "new," just a variant of the ANSI standard. I believe the "big" difference would be in the Teradata database hardware and structure itself.
```{sql}
select
START_DT,
START_H,
start_ts,
upper(NE_NODE_ID) as MGW
FROM teradata_db.M_OR_P
where Cast(start_DT As Date) >= CURRENT_DATE-1
and Cast(start_DT As Date) <= CURRENT_DATE-1
order by NE_NODE_ID, start_dt, start_H, start_ts
```