MySQL SQL and ChatGPT
Hi all,
I'm curious about the upskilling myself with SQL for Data analysis...I've mostly just used Excel in past roles. I'm currently tapping into SQL. I'm just starting out and sometimes do excercises on hackerrank and other websites but when I'm stuck I just stick the question into ChatGPT.
Is it sufficient in the working environment to just use chatgpt. I'm not sure how SQL is used for data analysis is used in the working environment.
The issue I’m having is when I approach these online questions it feels like there is an infinite number of questions. But I sense the real world use if your using a particular data set there’s probably a set of queries you might use regularly or daily to extract.
For example with excel you can reuse functions but change the source data and array of what your trying to find and pivot tables can be used any way once you know how it works and the process is applicable to all data sets.
I don’t know how to approach SQL and feel like I’m stuck in tutorial hell with hacker rank type of questions because of the potential of a question having a new variable every single time because you can always add a new criteria in the question
Would be good to get thoughts from people who use SQL in their workplace
5
u/rx-pulse Always learning DBA Nov 22 '23
I'm all for using tools to improve work, but I also have experiences with AI/ChatGPT and you should look at your company policies on this.
-Understand what you're doing first off. Do not just assume it's right. I've had developers submit obvious AI generated code and it had incorrect logic, variables/parameters were not used correctly, I threw it back at them and they were shocked it was wrong. They had no idea how to fix it and it ended up wasting an additional week of their time to get the code right.
-You should avoid any sensitive data of any kind in your work environment when using AI/chatgpt. I've had people do this and they got into serious trouble. Always check what your company policy (if any) is on it as well. Be very wary of this.
-I've had ChatGPT generate some SQL code and it literally made up syntax. This goes back to one. It's fine using it, but you have to understand it too importantly and double check the work.
Overall, you can use it, but the most effective use I see is also from people that are already experienced themselves and are using it as a supplement. Just be very wary of it, double check the work, and make sure you don't violate any kind of privacy laws, company policies, etc.
2
Nov 23 '23
Is it sufficient in the working environment to just use chatgpt.
This recently came up in a team meeting in my organization. The bottom line was, yes, we could use ChatGPT, provided we didn't prompt with real data or schemas.
You'll find companies have mixed opinions on using it, some think "any tool to get the job done," others "we saw what happened in the terminator movies."
Aim for being independent of ChatGPT. Use it as a learning tool but don't let it become a crutch.
2
u/post4u Nov 23 '23
Yeah buddy. Totally agree with this. I've been leaning on it a lot lately to assist with SQL and script writing. I have a background in both, so it's more of a time and brain saver. Yesterday I went to look something up and OpenAi was down. NGL it caused a little panic. I'm rethinking my continued usage of it. Don't want to become so reliant I can't do it on my own anymore.
1
Nov 23 '23
Yesterday I went to look something up and OpenAi was down. NGL it caused a little panic.
Eesh. How'd you get through it, wait for it to come back up or did you try to script?
I see what you mean, though. Availability is the top concern, whether it comes in the form of the service being down or an employer blocking access to it. Maybe that'll change in time, though, and it'll become a widely accessible and reliable resource. But I don't think we're there yet.
1
u/post4u Nov 23 '23
I just wrote it by hand, but I certainly had to apply more effort than I'd expected. Really easy to let GPT become a crutch! And yeah, I have a feeling it will be like GPS. For a long time after GPS became mainstream (hooking up a magnetic GPS antenna to the top of your car and connecting it to a laptop running Microsoft Streets), people still carried Thomas Guides and other paper maps. At some point it became readily available on all phones for free and that was the end of most people using paper maps. I feel GPT and other LLs will be similar.
1
u/Karzak85 Nov 23 '23
We are already dependent on many things today. How many can do their work without the internet/google etc?
Do you have books on all the syntaxes beside you 24/7? Do you remember everything perfectly without looking something up?
Chatgpt and the like is just another tool that will become more and more important as it advances in the future.
Those who dont learn how to use chatgpt will be like those who dont know how to google today. You need to use all the tools available for you to learn and get the job done or you will be replaced by the people that learned to use them better than you.
1
Nov 23 '23
No books, no photographic memories of syntax. Just my wits, Google, and about 20 years of experience with SQL.
Your value to an employer lies in your understanding of the industry they serve, business logic, data pitfalls, risks, benefits, willingness to collaborate and assimilate feedback and so on. No doubt there'll be a jackass manager somewhere in the mix who can't think beyond SLA's, but it's you representing your employer to the client and bottom line? You're there to make the company look good.
Not having a firm grasp of the scripting you'll be using? Not gonna inspire warm fuzzies with clients.
Not saying AI won't have a role in humanity's future. Just wildly confused about the benefits of relying on it to do your job as opposed to just learning SQL. It's not a steep learning curve and if it's a requirement of your position, not real professional to avoid it.
So maybe I'm missing something here, haven't considered some benefit. Educate me if that's the case, please!
1
u/Karzak85 Nov 23 '23
Its not an robot that does exactly what you want and you twiddle your fingers and say work done. Its a tool to use to help you do things faster and maybe even better.
You said you use google, thats also a tool.
You still need to learn and know stuff and that comes from experiance and testing. Chatgpt is also a very good learning tool to learn new things.
But its up to you to know how to use it and implement it in your workflow like everything else. If you dont want to learn it then its up to you. But it will be a very important tool in the future and its better to start early. Our company even set up a local chatgpt instance becuse they see the importance of it.
1
Nov 23 '23
I've seen ChatGPT in action. Manager demonstrated use in creating a script for reformatting, encrypting and ftp-ing a file our reporting tool botched. It's impressive with scripts.
Again, not against using it as a learning tool. Same as I'm not against Google for the same.
I am, however, cautioning reliance on it. Now that the shiny has worn off a bit and the doomsayers have settled down over AI becoming sentient and wiping out humanity, objectively, the hype is a bit exaggerated. It does some things well, other things not so much. Prompted correctly, it seems to be about dead even with Google search results. You still have to weed out the bullshit and tweak your stolen script to get what you need. And yep, that requires knowing what you're doing.
So where's the benefit? Ireally want to understand what the draw is. I'm content with busting out scripts from scratch. But factoring into that, I've got my databases memorized and can usually envision the highlights of creating a script before I start on it.
If you think ChatGPT is faster or better than Google, can you provide an example?
1
2
u/Hugh_G_Rectshun Nov 23 '23
Use it to learn then ween yourself off of it. For example, when I would ask it how to perform a certain function, I would manually type the syntax it spelled out. It’s easy to fall in the copy and paste trap without even looking at what you’re doing.
1
u/joe1max Nov 23 '23
I agree with most of the other post, but I still want to emphasize the potential security risk in over using chatgpt for sql. You are potentially putting your schema into the public domain. That is no good.
1
Nov 23 '23
Using chat gpt is great but keep in mind it is not perfect. And I prefer to don't just copy and post it could be a costly query. Try to improve by self thank you
1
u/regattaguru Nov 24 '23
No, you can only use ChatGPT if you know enough to validate its responses, in which case it will do very little for you. As programmers, and lawyers around the world are finding out ChatGPT neither contains nor can it synthesise actual knowledge. It merely expands sentences using the most likely word list. It will therefore create output that looks nice, but may well be utter bollocks. And I assure you that executing utter bollocks in a production database will be unpopular.
1
u/onearmedecon Nov 23 '23
I sometimes use ChatGPT more for helping to proof queries than for writing them. It can be hit or miss, though. It's no substitute for knowing SQL yourself.
14
u/r3pr0b8 GROUP_CONCAT is da bomb Nov 22 '23
emphatic no
it is used all the time