Fork of List of URL with invalid Top Level Domain by
This query is marked as a draft This query has been published by .

SQL

AخA
 
with TLDin as (
  SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(e.el_to_domain_index,'.',1),'/',-1) as TLD
  FROM externallinks as e
  JOIN page ON page_id = el_from
  WHERE page.page_id=12869134 
)
, p as (
  SELECT page.page_id, page.page_title 
  FROM page 
  WHERE page.page_namespace =0
) 
, TLDh as (
  SELECT DISTINCT e.el_to_domain_index, SUBSTRING_INDEX(SUBSTRING_INDEX(e.el_to_domain_index,'.',1),'/',-1) as TLD
  FROM externallinks as e INNER JOIN p
  ON p.page_id = e.el_from
  WHERE  SUBSTRING_INDEX(e.el_to_domain_index,':',1) in ('http','https') 
)
, TLDres as (
  SELECT TLDh.el_to_domain_index, TLDh.TLD
  FROM TLDh LEFT JOIN TLDin on  TLDh.TLD=TLDin.TLD
  WHERE TLDin.TLD is null
  LIMIT 20
)
SELECT CONCAT( '# ' , SUBSTRING_INDEX(SUBSTRING_INDEX(externallinks.el_to_domain_index,'.',1),'/',-1) , '  {{Bearbeiten|',p.page_title ,'|text=',p.page_title,'}}'  )as output 
  ,  externallinks.el_to_domain_index 
  ,  externallinks.el_to_path
FROM  externallinks INNER JOIN p
  ON p.page_id = externallinks.el_from
INNER JOIN TLDres 
  ON externallinks.el_to_domain_index = TLDres.el_to_domain_index
ORDER BY 1;
By running queries you agree to the Cloud Services Terms of Use and you irrevocably agree to release your SQL under CC0 License.
All SQL code is licensed under CC0 License.

Checking query status...