SQL : 比较行中的电子邮件地址,并检索未找到的行
SQL : Comparing email-addresses in row, and retrieve not found rows
我正在使用一个 Teradata 系统,其中有一个 table(TABLE_NAME),其中有一列 email_address_table
。我有一个 excel-sheet,其中有一列电子邮件地址。
我想要做的是检索 table 中的所有行,其中 email_address_table
不是 excel 中存在的电子邮件地址的一部分 sheet。
据我所知,Teradata
不能直接与 excel sheets 一起工作,所以我在 Java 中编写代码,在那里我可以检索个人列中的电子邮件地址,甚至将它们格式化为字符串,我想直接在 SQL 查询中使用它。因此,基本上,查询将根据我需要的语法在 Java 程序中形成。
输入:
+---------+----------+---------------------------------+
| id | name | Date |
+---------+----------+---------------------------------+
| 1 | abc@gmail.com | 21.03.2015 |
| 2 | def@gmail.com | 22.04.2015 |
| 3 | ajk@gmail.com | 22.03.2015 |
| 4 | ghi@gmail.com | 23.03.2015 |
| 5 | ghi@gmail.com | 23.03.2015 |
Excel sheet :
+---------+-----------+
| name |
+---------+-----------+
| abc@gmail.com |
| ccc@gmail.com |
| ggg@gmail.com |
| hhh@gmail.com |
| ghi@gmail.com |
预期查询:
select * from TABLE_NAME where email_address does not match any in {"email1","email2","email3"...."email-n"}
此外,TABLE_NAME 包含大约 80,000 个条目,excel sheet 包含大约 4000 个电子邮件地址。此搜索有什么最佳方法吗?
我该如何处理这个问题。我已经有来自 excel sheet 的电子邮件作为纯字符串,我可以复制粘贴,直接在 Java 中更改格式。谢谢你。
SELECT * FROM table_name WHERE email_address NOT IN ('email1', 'email2', 'email3')
我正在使用一个 Teradata 系统,其中有一个 table(TABLE_NAME),其中有一列 email_address_table
。我有一个 excel-sheet,其中有一列电子邮件地址。
我想要做的是检索 table 中的所有行,其中 email_address_table
不是 excel 中存在的电子邮件地址的一部分 sheet。
据我所知,Teradata
不能直接与 excel sheets 一起工作,所以我在 Java 中编写代码,在那里我可以检索个人列中的电子邮件地址,甚至将它们格式化为字符串,我想直接在 SQL 查询中使用它。因此,基本上,查询将根据我需要的语法在 Java 程序中形成。
输入:
+---------+----------+---------------------------------+
| id | name | Date |
+---------+----------+---------------------------------+
| 1 | abc@gmail.com | 21.03.2015 |
| 2 | def@gmail.com | 22.04.2015 |
| 3 | ajk@gmail.com | 22.03.2015 |
| 4 | ghi@gmail.com | 23.03.2015 |
| 5 | ghi@gmail.com | 23.03.2015 |
Excel sheet :
+---------+-----------+
| name |
+---------+-----------+
| abc@gmail.com |
| ccc@gmail.com |
| ggg@gmail.com |
| hhh@gmail.com |
| ghi@gmail.com |
预期查询:
select * from TABLE_NAME where email_address does not match any in {"email1","email2","email3"...."email-n"}
此外,TABLE_NAME 包含大约 80,000 个条目,excel sheet 包含大约 4000 个电子邮件地址。此搜索有什么最佳方法吗?
我该如何处理这个问题。我已经有来自 excel sheet 的电子邮件作为纯字符串,我可以复制粘贴,直接在 Java 中更改格式。谢谢你。
SELECT * FROM table_name WHERE email_address NOT IN ('email1', 'email2', 'email3')