Guest User

SQL Murder Mystery Solution

a guest
Dec 16th, 2019
534
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH cte AS
  2. (SELECT SQL AS name FROM sqlite_master WHERE SQL LIKE 'CREATE TRIGGER%'
  3. ),
  4. pos AS
  5. (SELECT charindex('hex(new.value)',name) pos, name FROM cte
  6. UNION ALL
  7. SELECT pos+charindex('hex(new.value)',substr(name, pos+1, LENGTH(name))) pos, name FROM pos
  8. WHERE charindex('hex(new.value)',substr(name, pos+1, LENGTH(name)))>0
  9. )
  10.                                        
  11. SELECT
  12. p.name AS [Solutions]
  13. FROM pos
  14. INNER JOIN person p ON hex(p.name) =  substr(pos.name, pos + 17, charindex('''', pos.name, pos + 17) - (pos + 17))
RAW Paste Data