 Hey everybody this is Brian and welcome to the 46th lamp tutorial. Today we're going to be going down the SQL road. SQL is a long, long road but we're going to try and make it a little easy. In this first video what we're going to do is we're going to use the MySQL workbench. Remember we downloaded this in a previous tutorial. If not you can just go out and Google MySQL workbench and just go install it. It's pretty easy. All right we've got no connections here so the first thing we need to do is actually create a new connection. And you may have a connection from when we set this up in a previous tutorial. All right so you just enter your password for your MySQL server. Notice how it has a specific port that it's running on 3306 by default. Click store in key chain and then always test your connection. Connection parameters are correct. If you get anything other than that that means you entered the wrong password. Go ahead okay. Oops. Forgot we need a name. My bad. And we'll call this PHP tutorial. Password should already be in the key chain but we're going to enter it again. Parameters are correct. Hit okay. All right now we've got our connection and notice how you can have more than one. So if you manage multiple MySQL servers. Yeah buddy you know what I'm talking about. You can actually manage multiple. Very nice tool. Just double click your connection. You'll see how it says connecting at the bottom. And it opens up this query editor. Now I'm not going to get too in depth into this program because there's a plethora of programs on how to work with MySQL but we are going to cover the basics. I'm going to use MySQL workbench because it does a lot of the heavy lifting and it allows me to explain things easier so I don't have to sit there and fumble my way through writing SQL scripts. All right over here you have your schemas which are also known as you guessed it databases. You see PHP My had been made one when we installed it and we have tables. So this is just kind of how this is laid out a standard database. You have your database and inside your database you'll have tables. Tables store information and inside of a table you have columns. Think of a spreadsheet. That's basically what these are. Big, big spreadsheets. The columns would be like ID, database, user, label, query, etc, etc. Whole bunch of stuff and we're just going to right click, select rows, limit 1,000 and there is the actual query we're using right there. Don't expect you to know what any of this stuff is. I'm just, you know, demonstrating here. Our future tutorials are going to explain all this stuff. So let's actually grab just anything here and select see if we can get no data. Let's edit table data and you can actually go in and add things if you wanted to things of that nature. Nice graphical smooth interface makes it very easy to work with. Let's see here. Altar table. This shows you how you can actually build a table and this is what a table looks like inside of a database. You just have columns and rows would be the actual data filling in. You notice how you got different types here like int, var care, text. Those are different than what you're used to. If you're used to a language like, well, PHP or Java or C++, you'll know what a variable is. A variable is something that will change. Well, databases have their own special type of variables or data types, I should say. So what we're doing is we're saying, well, this will be a variable called debase and its type will be var care and in parentheses it has 255 and what that means is it'll be variable length character 255 is the maximum size. Whereas a text is pretty much the same thing but it doesn't have a big limit. There is actually a limit but it's well beyond the scope of this tutorial. And then you've got different options here like pk, primary key and n not null meaning it can't be empty. I think UQ is unique and then you got AI for auto increment. Notice how it's got this little key icon here. That's called a primary key. Think of it in this term. You have a hundred people in your audience and you need to address a specific or find a specific person. How do you find that person? Well, somebody out there is saying, well, their name. Okay, we'll use their name. Let's say my name's Brian. Out of a hundred people, how many people are going to be named Brian? Well, then you have a first and last name. What if the name's John Smith? How many John Smiths will you have out of a hundred? You may have two or three. So you need a unique way of identifying those people or those rows in the database. That's where you get a primary key. And the primary key sole function is just say this is unique. Notice how it's a primary key and it's auto increment. And what that means is every time you add a record that number, because it's an integer, will automatically increment. So the first will be one, then two, then three, then four, and five, six, and you get the picture. So that is a very rough and loose database primer. In our coming tutorials, we're going to be jumping right into these and actually working with these. Just kind of go out, take a moment, get used to the menus, how things are laid out, what things do different things. And did that make any sense? What things do different things? Well, you know what I meant. Queries can be executed. You can query the database. You can reverse engineer. You can have plugins, scripting, etc., etc. Don't expect you to be a whiz with this. Basically, all you need to know is your databases are here. Inside your databases, you have tables. Inside your tables, you have columns. It's really all you need to know. We'll get into things like views and routines at another time. That's all for this tutorial. Hope you found this educational, and thank you for watching.