Giter VIP home page Giter VIP logo

Comments (2)

marcus-kempe avatar marcus-kempe commented on June 26, 2024

Well, I'd argue this is not an issue. If you are able to solve the mystery this way, solving it the intended way should be trivial.

It's rather a good third challenge, finding both culprits, using a single query, mastering some more advanced SQL concepts:

Spoiler warning

The following query would accomplish this:

WITH RECURSIVE split(content, last, rest) AS (
VALUES('', '', (select sql from sqlite_master where type = 'trigger' and name = 'check_solution'))
UNION ALL
  SELECT 
    CASE WHEN last = "'" 
            THEN
                substr(rest, 1, 1)
            ELSE
                content || substr(rest, 1, 1)
    END,
     substr(rest, 1, 1),
     substr(rest, 2)
  FROM split
  WHERE rest <> ''
)
SELECT 
       name     
FROM 
       split, person
WHERE 
       (last = "'" OR rest ='') AND hex(name) = REPLACE(content, "'",'');```
    
</details>  

from sql-mysteries.

RavindraWiguna avatar RavindraWiguna commented on June 26, 2024

If this was like CTF game, seeing the trigger's source code to check the answer would be a great solution (I did try this as my first attempt hehe), but this is more of a fun detective game to train/learn sql, so being able to see the answer right away with little modification kinda defeat the purpose.
Maybe keep it as possibility like we can do this after solving the intended way. So when we try to query the trigger, it give the result like " Haha, nice one detective, it is indeed a fast way to solve this mystery, but hey you are the greatest detective!, no need to cheat, use your SQL and BrainPower!. You can do this after solving the mystery"

from sql-mysteries.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.