top of page
Search

How to Parse URL Query Parameters using SQL


This is a simple pseudo code template for parsing query parameters from URLs.

SELECT
    url,
    substr(url,
        locate('qsp1', url, 1) + x,
        locate('qsp2', url, 1) - locate('qsp1', url, 1) - x) as qsp1,
    substr(url,
        locate('qspz' url, 1) + z, lenght(url)) as qspz
FROM url_table
        
        
  • qsp1: your first query parameter

    • x: the length of your first query parameter + 1 (to account for "=")

  • qsp2: your second query parameter

  • y: the length of your second query parameter + 1 (to account for "=")

  • qspz: the last query parameter




12 views0 comments

Comments


bottom of page