Rule 2: Tell ChatGPT what your database SQL framework allows. In this case, Redshift doesn't have the subquery functionality ChatGPT was trying to use. Instead I asked: "Can you accomplish this with the rank function?"