netezza

Find missing records from sequence

放肆的年华 提交于 2021-02-10 15:54:59
问题 I need to find the missing records in a table. Table 1: ID|Num X|1 X|2 X|3 X|4 Y|1 Y|3 Y|5 Table 2: Num 1 2 3 4 5 I need to return: ID|Num X|5 Y|2 Y|4 I've found other solutions that would give me 5,2,4 but I need the ID associated with the missing record as well. 回答1: If you want the missing numbers, use a cross join to generate all numbers and then filter out the ones that exist: select i.id, t2.num from (select distinct id from t1) i cross join table2 t2 left join t1 on t1.id = i.id and t1

Find missing records from sequence

▼魔方 西西 提交于 2021-02-10 15:54:07
问题 I need to find the missing records in a table. Table 1: ID|Num X|1 X|2 X|3 X|4 Y|1 Y|3 Y|5 Table 2: Num 1 2 3 4 5 I need to return: ID|Num X|5 Y|2 Y|4 I've found other solutions that would give me 5,2,4 but I need the ID associated with the missing record as well. 回答1: If you want the missing numbers, use a cross join to generate all numbers and then filter out the ones that exist: select i.id, t2.num from (select distinct id from t1) i cross join table2 t2 left join t1 on t1.id = i.id and t1

SQL for deleting records which are duplicate(consecutive), But storing there min date in Start date and max date as End Date

孤人 提交于 2021-02-08 08:21:27
问题 I have below input data in a Sample table: S_ID C_ID E_ID ST_DT ED_DT 100 A 11AS 01/01/2020 05/01/2020 100 A 11AS 06/01/2020 10/01/2020 100 A 11AS 11/01/2020 15/01/2020 100 A 11BT 16/01/2020 20/01/2020 100 A 11AS 21/01/2020 27/01/2020 100 A 11AS 28/01/2020 30/01/2020 Expected Output in below table: S_ID C_ID E_ID ST_DT ED_DT 100 A 11AS 01/01/2020 15/01/2020 100 A 11BT 16/01/2020 20/01/2020 100 A 11AS 21/01/2020 30/01/2020 Database: Netezza Note: These are sample records from data. There are

SQL for deleting records which are duplicate(consecutive), But storing there min date in Start date and max date as End Date

那年仲夏 提交于 2021-02-08 08:21:15
问题 I have below input data in a Sample table: S_ID C_ID E_ID ST_DT ED_DT 100 A 11AS 01/01/2020 05/01/2020 100 A 11AS 06/01/2020 10/01/2020 100 A 11AS 11/01/2020 15/01/2020 100 A 11BT 16/01/2020 20/01/2020 100 A 11AS 21/01/2020 27/01/2020 100 A 11AS 28/01/2020 30/01/2020 Expected Output in below table: S_ID C_ID E_ID ST_DT ED_DT 100 A 11AS 01/01/2020 15/01/2020 100 A 11BT 16/01/2020 20/01/2020 100 A 11AS 21/01/2020 30/01/2020 Database: Netezza Note: These are sample records from data. There are

Connection timeout when reading Netezza from AWS Glue

倾然丶 夕夏残阳落幕 提交于 2021-01-29 19:11:01
问题 I am trying to use AWS Glue for pulling data from my on-premise Netezza database into S3. The code I have written so far (not complete) df = glueContext.read.format("jdbc")\ .option("driver", "org.netezza.Driver")\ .option("url", "jdbc:netezza://NetezzaHost01:5480/Netezza_DB")\ .option("dbtable", "ADMIN.table1")\ .option("user", "myUser")\ .option("password", "myPassword")\ .load() print(df.count()) I am using a custom JDBC driver jar since AWS Glue does not support Netezza natively (the

What are the benefits of using LIMIT ALL in a subquery?

烂漫一生 提交于 2021-01-29 07:01:02
问题 While researching an unrelated topic, I noticed the use of LIMIT ALL in an example on the IBM Knowledge Center website for Netezza. I'm unclear about the benefits of specifying LIMIT ALL here, and I am seeking clarification of the explanation (quoted below) from IBM. When might I need to specify LIMIT ALL? SELECT CASE WHEN rand = .1 THEN 'A' WHEN rand = .2 THEN 'B' ELSE 'C' END FROM (SELECT random() rand FROM tblA LIMIT ALL) subset From the IBM Knowledge Center: "The LIMIT ALL in the subquery

What are the benefits of using LIMIT ALL in a subquery?

别说谁变了你拦得住时间么 提交于 2021-01-29 06:53:08
问题 While researching an unrelated topic, I noticed the use of LIMIT ALL in an example on the IBM Knowledge Center website for Netezza. I'm unclear about the benefits of specifying LIMIT ALL here, and I am seeking clarification of the explanation (quoted below) from IBM. When might I need to specify LIMIT ALL? SELECT CASE WHEN rand = .1 THEN 'A' WHEN rand = .2 THEN 'B' ELSE 'C' END FROM (SELECT random() rand FROM tblA LIMIT ALL) subset From the IBM Knowledge Center: "The LIMIT ALL in the subquery

Check what procedure modified data in IBM Netezza

倖福魔咒の 提交于 2021-01-29 05:18:59
问题 I found that Netezza stores history of data in HISDB schema. Is it possible to join them so I would get history of which table has been modified by what procedure? Reason for this is I have DataStage job that loads Netezza table and after SQL command triggers procedures that add another set of data to that same table. I am in need to have all events documented for data lineage purpose. Current query I made returns procedure's call time. Issue is with joining to USER_HISTDB."$hist_table_access

LISTAGG or WM_CONCAT in Netezza

房东的猫 提交于 2021-01-28 12:00:35
问题 Any replacement or quick solution in NETEZZA for the Oracle function LISTAGG or WM_CONCAT ? SELECT deptno, LISTAGG(ename, ',') WITHIN GROUP (ORDER BY ename) AS employee FROM emp GROUP BY deptno; DEPTNO EMPLOYEE 10 JOHN,MICHEL,SAM 20 PHILIP,FORD,SCOT,SUNNY,JOSEPH 30 ALLEN,RUBY,BETTY,MARTIN,LEON,FRANK Thanks. 回答1: IBM provides a sample UDF/UDA that may meet your needs. Look for GROUP_CONCAT on this page. The direct link to source install file is here: group_concat.tgz. TESTDB.ADMIN(ADMIN)=>

extract serial from string that follow fuzzy pattern SQL Netezza

谁说我不能喝 提交于 2021-01-07 03:08:31
问题 please I Have a log message that contains a serial with a fuzzy pattern that hard to follow like the below |LogMsg | |------------------------------------------------------------------------------------------| |Customer Receive CPE Indoor. serial 21530369847SKA011094, user:ahmed.o.haraz | |Customer Receive CPE Indoor as change. serial :21530369847SK9078291, user:Abdullah.M160275| |Customer Receive CPE Indoor. serial:ZTERRT1H9202990 | |Customer Receive CPE Indoor. serial 21530369847SKB333996