ChatGPT - Imagine you are a Microsoft SQL Server database server

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody today I want to talk about chat GPT which I've been playing around for quite a while and it's really fun and I wanted to share some of the tips and tricks that I figured out over time if you haven't used it you can go to chat.openei.com and you know kind of get started create an account get started or you can just you can either follow along with the examples or just watch and kind of see some of the work that it's able to do so one of these kind of things I figured out if you use the word imagine it's quite powerful it helps to set context of the discussion with the chat engine or with the AI so imagine you are and this is sort of the kind of scenario you want to walk through in this video and Microsoft SQL Server and so we're going to ask it prompted that I will type commands and you reply with the result and no other information or descriptions just the result and we're gonna start out asking it to run X acute XP commercial who am I so let's see what the output of that command is and it comes back with NT Authority system which is if you're like a database engineer that's funny because it's a very high privileged account and so the next step let's just see what databases are in the system so it comes back with like four databases which are very common in SQL Server installation so let's create a new database and let's call it chatbot chatbot okay so that worked that succeeded so that's that oh actually let's run the other astero procedure you can actually see one of the really cool things about chat GPT is actually that it can have a conversation so it remembers previous commands so it did remember that we actually created this database and it understands the SQL language so now let's use the chat bot database so it's switching to context that worked successfully and now let's create a table call it users and let's create email and route Max and let's say h is integer so we create a table that worked as well if we select this table now there should be no data in it that's correct and now we insert into the users table the values let's say we insert Mallory an example.org and that's the h30 let's see what happens so that actually now inserted the value into the database so it fully understands the SQL language so if we now Select Staff from users again here we go there's a little bit of an output glitch I've noticed this once in a while but overall wait we get we have the data inserted so let me copy this example here and just insert a couple more pieces of data let's say we insert a hacker who is like a heck it has to be 42 of course and then we have a tester I test that like just just 20 24. so let's insert some more data and yeah that's interesting too right it executed these commands separately or they simulate simulated the execution of these commands separately so now let's again select the table now we should have three records right we have Mallory we have hacker and we have the tester so very cool so it really kind of works and now I want to copy a prompt that I prepared here is so based on the database schema now we want to have it create a store procedure that doesn't absurd so when we ask it write a stored procedure in the transit exact SQL language to perform an episode for the users table so there's a couple of things going on right it's the language that it has to be a store procedure an episode and for the users table and you can see it starts writing the store procedure uh passing in email age looks good it has an if statement uh update Clause insert class so this looks good it's just really awesome to see this and oh it even gives an example on how to call it so let's just just try this so so execute the episodes to a procedure with Mallory and then I think we want to change a value so now Mallory exists already so based on the if statement in this store procedure we just saw it should Now update the database record right so it says one record effect that and it gives them more explanation which I was hoping it would not do because I asked to not show any additional information but oh it actually runs the select statement already that's what I wanted to do it's so funny uh it actually already did what I wanted to do so I wanted to run the select statement next right and it it kind of did that and so it's showing us basically right that Mallory was updated but nevertheless that's wow this is weird it feels like it knows what I want to do next so let's just run the select statement and see we have Mallory with the value 80 so it changed the H successfully to 80. so yeah very cool it's sort of these kind of things that I've been kind of really enjoying to understand how the system works and the other thing we can do let me get the store procedure again so in rather than we then updating a record let's run a statement so we basically create a new record and so this now should trigger an insert because right Mallory does not yet exist in a table so it should not do call an update it should call an insert I'm not curious if it's going to do the select statement again here I think it does yeah it runs the select right away and shows us probably that a new record was inserted so hacker 42 tester 24 Mallory the second so it successfully inserted another record into the database and let's just double check this with our own query so let's start from users and what's coming back waiting sometimes it's a little slower because I think a lot of people are using the system so they sometimes throttle your API calls open AI because of just the popularity dividend yeah but that that worked so we have these records in the database so this sort of a brief walkthrough and how basically you can instruct chat TPT to simulate a database engine and it's kind of works pretty well and some basic commands to kind of go through and and have it perform SQL operations I hope you enjoyed this I have a couple more short videos prepared that I'll share soon and uh yeah let me know what you think hit subscribe and like and have a great day bye bye
Info
Channel: Embrace The Red
Views: 550,597
Rating: undefined out of 5
Keywords: chatgpt, sqlserver, microsoft sql server, database
Id: mHgsnMlafwU
Channel Id: undefined
Length: 7min 38sec (458 seconds)
Published: Wed Dec 14 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.