What part of "the code was horrendous" did not click with your sentiment? It was horrible. The entire database was one table. Every SQL query was a SELECT *, and filtered everything downstream in the code rather than WHERE. It was absolutely horrible code that I am shocked actually worked with any kind of speed that actually felt responsive. Of course I didn't have millions of records, but the fact that it worked at all was encouraging enough to me that I'm still doing it to this day in the same language. Only now I've been doing it for 20+ years and I'm much less embarrassed about my code, or maybe more. At least back then I could use "I'm a beginner" as an excuse.
I am quite sure most people who have only learned programming for one weekend would write much worse code than ChatGPT.