Created
February 28, 2018 07:40
-
-
Save Goryudyuma/1d70a0bce8521e7cc6515fd9850d577e to your computer and use it in GitHub Desktop.
MISQUERY ONLINE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH RECURSIVE solve(strrow,str) AS ( | |
SELECT str,str | |
FROM tbl | |
UNION ALL | |
SELECT strrow,REPLACE(REPLACE(REPLACE(str, '()', ''),'{}',''),'[]','') | |
FROM solve | |
WHERE str!=REPLACE(REPLACE(REPLACE(str, '()', ''),'{}',''),'[]','') | |
) | |
SELECT i, | |
CASE WHEN str IN | |
( | |
SELECT strrow | |
FROM solve | |
WHERE str = '' | |
) THEN 'YES' | |
ELSE 'NO' | |
END AS judgement | |
FROM tbl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment