teradata

hadoop vs teradata what is the difference

独自空忆成欢 提交于 2019-12-20 10:46:39
问题 I've touched a Teradata. I've never touched hadoop, but since yesterday, I am doing some research on that. By description of both, they seem quite interchangable, but in some papers it is written that they serve for different purposes. But all I found is vague. I am confused. Has anybody experience with both of them? What is the serious difference between them? Simple Example: I want to build ETL which will transform billions rows of raw data and organize them to DWH. Then do some resources

teradata, reset when, partition by, order by

只谈情不闲聊 提交于 2019-12-20 06:15:06
问题 I need help understanding the below code. I have never seen reset when used in Teradata. What does RESET WHEN do in Teradata? I understand the partition and order by part. I was also unsure why this wasn't partitioned by PARTITION BY A.ACCT_DIM_NB, A.DAY_TIME_DIM_NB ORDER BY A.TXN_POSTING_SEQ . Also, is ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW just using the whole partitioned window? Removed 回答1: I was also unsure why this wasn't partitioned by PARTITION BY Y.ACCT_DIM_NB, Y.DAY_TIME

How to execute multiple queries in teradata?

放肆的年华 提交于 2019-12-20 05:35:15
问题 For example a query : create table ; select xxx ; delete ; How to execute it in one session ? I saw one answer to a similar question about mysql. The trick is to turn on allow multiple queries String dbUrl = "jdbc:mysql:///test?allowMultiQueries=true"; For teradata specifically, what is the solution ? I tried String dbUrl = "jdbc:odbc:dsn?allowMultiQueries=true"; It is not properly working ? 回答1: You're looking for a Multi Statement Request (MSR). It's simply sending multiple SQL statements

SQL/Regex Challenge/Puzzle: How to remove comments from SQL code (by using SQL query)?

谁都会走 提交于 2019-12-20 04:22:51
问题 Requirements Single-lines comments (e.g. -- my comment) should be removed. Multi-line comments (e.g. /* my comment */) should be removed. The content of strings literals (e.g. 'this is a multi-line comment: /* my comment */') should be ignored. The content of identifiers (e.g. "-- column 1 --") should be ignored. literals and identifiers Literals and identifiers can span over multiple lines Single-line comments A single-line comment might be the last element of the code and might not end with

How can I create a table with a dynamic name (based on current_date) and reference to it in INSERT statements?

北战南征 提交于 2019-12-20 03:54:07
问题 At the moment I have to rerun data selection query every month, where I create one base table. This table is named something like MyDB.MyTable_Current_Date , so for today that would be MyDB.MyTable_201811 using YYYYMM date format. Instead of having to set the name manually (using ctrl + h), I would like this to be done automaticaly. My goal is that I can open the SQL and run the query where the the table that is created is MyTable_YYYYMM . Note: eventually I want to also let the SQL run

Sessionize a column of numbers into groups of 30 once a threshold is met in Teradata

北战南征 提交于 2019-12-20 02:42:16
问题 Consider a column that represents "time between events": (5, 40, 3, 6, 0, 9, 0, 4, 5, 18, 2, 4, 3, 2) I would like to group these into buckets of 30, but buckets that reset. Desired outcome: (0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2) This is because, when we get to a cumulative 30, we "reset" and begin counting again. So, 5 + 40 > 30, we drop down to zero and begin cumulative adding until we reach 30...(3 + 6 + 0 ...), which happens at when we reach 10th element == 18. This can be implemented

Create table but Drop it if the table exists already

淺唱寂寞╮ 提交于 2019-12-19 09:25:04
问题 I am working on a request where I have to create a table to insert some data. So, obviously I will have first have a delete table st. before the create st. but when I am running this for the first time(before the table can be created) it will pop up an error saying table not created and then creates table and goe son from here. So every time any one runs my code for the first time it will pop up this error at drop table st. Does any one have any better idea?? Some thing like " if table exists

Connected Components

本小妞迷上赌 提交于 2019-12-18 18:10:01
问题 I have a set of data that has been created by matching together similar sub-items, and then GROUPing these similar items by "category". Now, the resultant categories must be matched in such a way that groups related categories together within each "group_id". In the example below, one match is A->B->C->D->E->F->G, which is obtained by recursing through rows. I've posted my current answer, which works on this simple data set, but because the actual data set contains up to 1M rows, and there

Connected Components

耗尽温柔 提交于 2019-12-18 18:09:11
问题 I have a set of data that has been created by matching together similar sub-items, and then GROUPing these similar items by "category". Now, the resultant categories must be matched in such a way that groups related categories together within each "group_id". In the example below, one match is A->B->C->D->E->F->G, which is obtained by recursing through rows. I've posted my current answer, which works on this simple data set, but because the actual data set contains up to 1M rows, and there

How to calculate moving sum with reset based on condition in teradata SQL?

丶灬走出姿态 提交于 2019-12-18 04:52:23
问题 I have this data and I want to sum the field USAGE_FLAG but reset when it drops to 0 or moves to a new ID keeping the dataset ordered by SU_ID and WEEK : SU_ID WEEK USAGE_FLAG 100 1 0 100 2 7 100 3 7 100 4 0 101 1 0 101 2 7 101 3 0 101 4 7 102 1 7 102 2 7 102 3 7 102 4 0 So I want to create this table: SU_ID WEEK USAGE_FLAG SUM 100 1 0 0 100 2 7 7 100 3 7 14 100 4 0 0 101 1 0 0 101 2 7 7 101 3 0 0 101 4 7 7 102 1 7 7 102 2 7 14 102 3 7 21 102 4 0 0 I have tried the MSUM() function using GROUP