 and welcome to this video by FilmsByChris.com. That's Chris with the K. There's a link in the description. I am Chris, also with the K. And today we're gonna continue, and this is the second video in a series, be sure to check out the description of this video for a full playlist. We're working with SQL Lite 3 databases. Last one we used the application went in and manually entered stuff. We'll say we're gonna be looking at accessing it basically without going into the program but just running commands at your shell that you can later on use in scripts. So again, be sure to watch out that first video on making sure you have the right version installed and how to get this all set up. So we do have a database right here example. Let's go ahead and create a new database. We could work with that one and add a second table but we're going to just start from scratch here but save that database which is one of the advantages. Well, I'll talk in the next video about using the databases and when to choose what type of database. Anyway, so last time we used the SQLite 3, I'm sorry, SQLite 3 command and we gave it a name like example.db. I'll just call this example2.db. If I was to hit enter now, it would bring me into that program. It will create a blank database and bring me into the program where I can start entering commands. The thing is you can use those same exact commands but if you get them here in quotations right at the shell, it will run those commands and exit out of the program which makes it great for writing scripts. So I'm going to say create table and we'll call this table. Last time we call it table one. Here I'll just call it people because we're going to enter the same type of information last time. So we're going to go in here and I'm going to say, we're going to create a field called fname and a field called lname and a field called phone. I'll go ahead and hit enter and we just created a database again. If I list out my files, you can see them here. I can say file example2.db and you can see right here that it's created a database. Okay, so now we have that. It has a table. We created a database, created a table with fields, with columns. Now let's start inserting rows into that table. So again, I'm going to say SQLite3 example2.db and now I'm going to say, insert into our table. I called it people this time into people values and here I can give it John comma and I'm going to be ununique and say John Smith. Oh, let's see. Okay, table has three columns but two values were supplied. So it's looking at that and wanting me to enter something for the value of the phone. So for right now, I'll just go do that. We'll talk about more about that in a minute and I'm just going to say 555-555-5555 because we were created as just a, oh, I forgot to say that they were text fields. Let's go ahead and just enter that in there for now and well, let's go ahead and just, I messed up. Let's go ahead and just remove that file and I'm not sure what type of fields it creates by default. I'll have to look into that. Oh, remove that. Let's go back up in commands here and here we create this and we really should say what type of field is whether it's a character field, a number field and they have much different fields and again, I'm just going to label them all as text for right now. When you get deeper into databases, you're going to want to specify what type it is and I don't know if it matters if those are capital or not. Okay, that's fine. Now, real quick, let's see what happens if I do that. Okay, yeah, we do need to give it the phone number. Okay, so we've now entered in that value. Let's go ahead and add in someone else. Again, we'll just go Rick Smith and Bob Smith and they all seem to have the same phone number at this point, but I'm just quickly entering in names. We'll go ahead and change this phone number here to that and we'll say Smith's son. I'm purposely putting in similar names to show because we don't have such few names how we can search through stuff and we'll call this guy Richard's son. We'll call him Larry and we'll say Thompson. We'll call him Jack. Okay, now just like in the last tutorial, if we wanted to view something, let's go ahead and clear the screen. We'll just say again, SQLite, whoops, that's not the right, sorry, SQLite, if I said it right, maybe I would type it right, SQLite. And then we'll give it the name of our database too and then we're gonna say in here, select all from and name our table in this case is people and it should display everybody in there. And again, instead of saying all if we want to, we can say L name. Now we're looking at all the last names. We can say comma F name. Now we have last names and first names. And if we want to, we can say last name and first name. If we want to, I could probably do this. First name, last name, first name. Yep, we can output it like that if we wanted. Go ahead and clear the screen. And of course, if we want to, we can also put in there and say there, we can say phone number and get the phone number. And of course, it's hidden unless you request it, but it's there is the row ID, which auto increments and we have them all through there. Now, if we wanted to delete someone like Bob Smithson or if we wanted to find, before we do that, let's search for all that information where L name is like. I'm sorry, that's going on to a new line there but that says like. And then we're going to say like and we're going to say in single quotes here since we're using double quotes on the outside there or we can escape them out. We'll say percent son. And that should list everybody whose last name ends in son. If we wanted to, we could also say Smith. And now it's everybody with the last name Smith or at least begins with Smith. Now let's say we wanted to delete Rick Smith. So we're going to come here. Let's just start typing it. SQLite 3, sorry, SQLite 3, example 2.db. And we're going to say delete. And where are we going to delete? We're going to delete where the ID is. Did I already forgot his ID number? Let's go ahead and look at this again. Okay, now we're going to say SQLite 3, example 2.db. And we're going to say delete. And from here we're going to delete from not table one, people, his name of our table. And we're going to delete where the row ID equals. And we're just going to go ahead and get rid of Bob Smith's number four there. So we should be able to do that. And he has been deleted. If we run that last command again, you can see that the only people with last names and in son are Larry and Jack. We wanted to get rid of Larry. We can go ahead and say he is number five. We're going to remove him. And again, if we display everybody in the database, or in that table, at least, finish the quotations there, you can see that it has removed them and their IDs. But if we were to add someone in, so again, if we were to run this command, let's just say, control our insert into values, Kelly, Thompson, sure, give them a new phone number. There we go. And we were to display all that out. You can see that they added Kelly at the bottom there with a new row ID. So basically, as you can see, it's all the same commands that you would do if you're inside the SQLite program, but we're just putting them in quotations there and saying what database. And it's now modifying it all or getting that information without going into the program. And so this allows us to script it out. And that's what we're gonna play with in the next video. So be sure to check that out. I do thank you for watching. This is again, a video by Chris of filmsbychris.com. That's Chris with a K. There is a link in the description. There you can search through all my videos from both my channels, giving us a little thumbnails there. There's also a support section there. If you click support, it brings it down there. You can support me if you like my videos through PayPal or Patreon. There's also should be a link to the Patreon page in the description of this video, which is on patreon.com forward slash metalx1000. That's metalx1000. That's unfortunately my username that I picked many years ago and I'm stuck with now. And yeah, you can also look through all my notes. I do have notes on all this. If you go to my webpage, click on where it says scripts, I believe. And then you'll have a section there that has scripts, notes. That's it. Let me just bring you there right here. Let's go filmsbychris. And again, the support section will bring you to where you can support me financially if you can. And we have software. The software section has my GitLab account with bigger projects. Scripts, which are scripts I have running on my web server that you can play around with. And then notes, notes will bring me to this. And if you were to type in SQLite, you can see that I have a few tutorials here. Most of the ones that we're looking at are from this SQLite three. I have notes similar to what we're doing here in there. I also looks like I have a database one on doing it on Android phone probably with text messages. And then the Nokia N900 if you have one of those. I do thank you for watching. And as always, I hope that you have a great day.