sql mk_3316_1 :: clearbit_prep

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql mk_3316_1 :: clearbit_prep相关的知识,希望对你有一定的参考价值。

INSERT INTO
				mk_clearbit.emails_to_process
WITH cte_new_signups AS 
(
	SELECT DISTINCT 
				LOWER(t2.email) AS email_address
	FROM 
				analysis_contacts_for_clearbit t1
	INNER JOIN
				contacts t2
				ON t1.contact_id = t2.contact_id
)
SELECT
				t1.email_address,
				GETDATE() AS created_at
FROM
				cte_new_signups t1
LEFT JOIN 
				(
					SELECT
								DISTINCT
								LOWER(email_address) AS email_address
					FROM
								mk_clearbit.emails_to_process
					UNION
					SELECT
								DISTINCT
								LOWER(mk_email)
					FROM
								mk_clearbit.persons
				) AS t2
				ON 	LOWER(t1.email_address) = LOWER(t2.email_address)
LEFT JOIN 
				(
					SELECT
								DISTINCT
								LOWER(domain) AS domain
					FROM
								mk_clearbit.companies
					WHERE
								emailProvider = true
				) t3
				ON LOWER(SUBSTRING(t1.email_address FROM POSITION('@' IN t1.email_address) + 1 )) = LOWER(t3.domain)
WHERE
				t2.email_address IS NULL
				AND t3.domain IS NULL
				AND LOWER(SUBSTRING(t1.email_address FROM POSITION('@' IN t1.email_address)+1)) NOT IN ('hotmail.com', 'qq.com', 'outlook.com')
				AND LOWER(SUBSTRING(t1.email_address FROM POSITION('@' IN t1.email_address)+1)) NOT LIKE 'hotmail.%'
				AND LOWER(SUBSTRING(t1.email_address FROM POSITION('@' IN t1.email_address)+1)) NOT LIKE 'yahoo.%'
				AND LOWER(SUBSTRING(t1.email_address FROM POSITION('@' IN t1.email_address)+1)) NOT LIKE 'live.%'
;
 
INSERT INTO
				mk_clearbit.domains_to_process
WITH cte_new_signups AS 
(
	SELECT DISTINCT
					LOWER(SUBSTRING(t2.email FROM POSITION('@' IN t2.email)+1)) AS domain
	FROM 
					analysis_contacts_for_clearbit t1
	INNER JOIN
					contacts t2
					ON t1.contact_id = t2.contact_id
)
SELECT
				t1.domain,
				GETDATE() AS created_at
FROM
				cte_new_signups t1
LEFT JOIN 
				(
					SELECT
									LOWER(domain) AS domain
					FROM
									mk_clearbit.domains_to_process
					UNION
					SELECT
									LOWER(mk_domain)
					FROM
									mk_clearbit.companies
				) AS t2
				ON LOWER(t1.domain) = LOWER(t2.domain)
WHERE
			t2.domain IS NULL
;

以上是关于sql mk_3316_1 :: clearbit_prep的主要内容,如果未能解决你的问题,请参考以下文章

BZOJ_3316_JC loves Mkk_ 二分答案 + 单调队列

startup_MK64F12.s 文件详解

一个通用的Makefile框架

使用 IDA 逆向关于 gs 段的一些令人困惑的问题

mk文件配置第三方jar包,so文件

json Clearbit