Pacific-Design.com

    
Home Index

1. Databases

2. SQL Case

Databases / SQL Case /

Partition based on standardized URL


-- source : http://www.pacific-design.com/Big_Data/MySQL/Partition/ 
-- clean  : pacific-design.com/Big_Data/MySQL/Partition
-- sha256 : 2d6ebfc7641114e3ba8a06b07f11546020985475ec81d76b131c7568a0df8cc4 

SELECT 
SHA2(
  REPLACE(
    REPLACE(

      CASE ( RIGHT(url,1)) 
      WHEN "/" 
        THEN LEFT(url, (SELECT (LENGTH(url) - 1))) 
        ELSE url 
      END 

    , 'http://', '' ) 
   , 'www.', '' )
  , 256)
FROM engine50.part_cc4;