Placeholder Image

字幕表 動画を再生する

  • creating these classes requires equipment and service.

  • Is that cost money?

  • If you appreciate this education, please think about going to Eli the computer guy dot com and offering a one time or monthly recurring donation.

  • Welcome back.

  • So as you know, I'm Eli to Computer Guy.

  • And today I just want to do a small class talking about data types for values that you were going to be putting into your my sequel database.

  • So this is one of those things.

  • It's very important from a high level point of view.

  • So if you're going to going out there, you're gonna be creating a front end you're going to.

  • Using my sequel in a production environment is very important.

  • Understand why data types are significant and is also one of the things that can really screw up new people.

  • So there's kind of one of those it's important all the way around.

  • So what are we talking about when we're talking about data types for the values that you're going be in putting into your my sequel database?

  • Basically, all we're asking here is what type of information are you going to be in putting into your my sequel?

  • database as a value.

  • So is that a name?

  • Isn't it a?

  • Is it a price Isn't a file.

  • You can actually put files.

  • Something called a blob data type into my secret database.

  • Is it a date?

  • Is it any number of different types of data types that could be a value in your database?

  • Now, why is it important to designate what something is?

  • Why is that important?

  • To designate that something is text or something is an end or something is a float or a decimal or a blob so on and so forth?

  • Well, one of the problems you run into in the real world when you put a database into a production environment is at some point you're going to have a front encoder that does something.

  • Asa nine Lee stupid.

  • Right there sitting there.

  • They've been working 100 hours that week.

  • They're trying to get a get a front end and deployed some kind of submission form.

  • So basically, somebody's going to submit their names, always gonna submit their their age, their T shirt size, whatever else, and that's goingto populate your database.

  • Well, the problem is, is if they're not thinking about things right and they do something stupid.

  • Basically, what they could dio is they could.

  • They could have the name of field trying to input data into the age column in your database.

  • Or they could try to put the age field going into the name column in your database.

  • And that can cause a lot of issues.

  • Now, if it's if it's a big problem, right?

  • So if you get 1000 new records and all of that information is screwed up, that might actually not be the worst thing that could happen to you.

  • The worst thing that could happen to you is if only one or two values are able to be inputted into the improper place within a database that can cause you a massive, massive issue.

  • Right, So basically, imagine if you're going to do something like taking an average.

  • So let's say you want to take the average of all the invoices, so you have the total for invoices, all the invoices your company is doing.

  • So you have thousands of thousands and thousands of these invoices, and you just want to see what the average invoice value iss, right?

  • So basically you will create a little script.

  • It'll go in, it will grab, grab all the different values.

  • It will add them all up and then we'll divide them.

  • Well, one of problems you can run into is you know, basically as that script is going through when it's saying OK, this value is 100 this value is 200 this value is 300.

  • And this value is Bob and his values.

  • 1000.

  • This value is 4000.

  • This value is 10 right?

  • One of the issues you can run into is that basically, when that script is going through to do the math that it actually does try to add Bob right one plus Bob equals what?

  • Right.

  • This is one of those times where you actually hope in a real production environment, you actually hope it fails.

  • You hope it fails.

  • Because if it fails, then you know that there is a problem.

  • And then you got to go in there and try to figure out what the hell is going off.

  • One of things that happens in the real world sometimes is two plus bob equals something right on again, especially when you start doing a large scale math.

  • That could be a real issue if you If you're adding up 10,000 different values and one of those values is Bob, it may skew the output that you're getting the end result that you're getting.

  • But it may not skew it to such a degree that the human eye recognizes that it's screwed up.

  • You know, he said, there you look at a go.

  • I I thought the value of the invoices would be a little bit higher than that.

  • But okay, I guess if if the computer tells me that this is what the output is, I guess I guess that's what we're doing.

  • We're gonna have to go out there and start flogging some sales people.

  • Right?

  • So the important thing with data types is, what you can do is you can say this field in the database will only accept this type of data.

  • If you try to put Bob into an ent field, that only allows that a type of end So integer is a whole number one.

  • The 10 negative 10 100 1000 right?

  • So you try to put Bob into a field that only allows for ends that will then fail out, so that could be a useful thing.

  • One of the problems, though, and this is the problem for new people, is if you don't understand the different data types, you can also run into some issues when you're trying to put data into your database.

  • So again an ant is a whole number is an integer 1 10 1000 and 20 10,000 and 20 negative 10,000.

  • A whole number is an end, a float or a decimal.

  • That is a number that has the decimal point to it.

  • So 10.1200 point 55 that type of thing that would either be a float or decimal.

  • So one of the problems you could get into again when you're new to coding for my sequel or any of these databases is, let's say you're trying to create it creates some kind of invoicing system, and so you have the price.

  • And so it's, you know, 100 and $200.25 or $10.5 and they're doing taxes and all that kind of stuff.

  • One of problems you can run into is If when the data goes into the database, it strips off the decimal point or you have some other kind of issue, then you can run into some issues there.

  • And you think, Well, wait a minute.

  • I don't understand because it's an end.

  • It's a number.

  • It's a number value type.

  • Therefore, I should be able to do this.

  • But again, there's different number value types.

  • There's intake, yours, there's floats, there's decimals.

  • There's that kind of thing.

  • So basically, all we're talking about when we're talking about the data types here is we're just talking about what type of data is able be inputted as a value into a particular column within a database.

  • Why this is important again for the high level professionals is because you don't you don't want to find that you don't want to find out what you believe Bob equals.

  • Doesn't matter.

  • You don't let that happen on why this could be an issue for new peoples again.

  • You go in your design, your database, you're feeling all good on.

  • Then you find out that there was a reason whenever you're whenever you have the code and is trying to put that into the database that it fails out.

  • And the reason it may be failing out of that mate, Maybe a reason that's causing problems is because you're putting in a different type of data type.

  • Then what you've assigned for that particular column.

  • So that's what we're talking about data types here and why this is important.

  • So for this class, I'm not going to go through all of the different data types.

  • There were actually a shocking number of data types out there.

  • And again, if you start dealing with databases to a significant degree, you will learn and you will memorize all of these data types.

  • And you will figure out which one is the best to use in any particular situation.

  • But for special a lot of new people.

  • Or if you're just trying to learn, we don't We don't need to go that far in the wart woods.

  • We don't have to go that far in the woods for you to get the point in the real world when you were learning this stuff.

  • Basically, what you wanna dio is you want to figure out okay, I'm gonna have a form, and this form is going be collecting this type of data and you Okay, what data type is that?

  • And you do do do a Google search.

  • You okay that data types that that data types, that that tops that.

  • And then you go you're my secret database and you design your my single database.

  • And again, that's how people do it in the real world.

  • So with that, let's go to the computer so I can show you I can show you one page.

  • That's kind of a feat.

  • She gives you some explanation of these different data types, and then we'll go to the actual my sequel reference where it gets much Maur End of the weeds and maybe more important for you again, if you're if you're actually go out and start designing things that will be going into a production environment.

  • So as with anything in coding or really almost anything that you do in the technology world, if you're trying to figure something out, one of the best things to Dio is just simply plug it into Google and see what shows up.

  • When you're dealing with any kind of Cody and stuff, you're dealing with any kind of like database type information.

  • One.

  • The important thing is to understand is people learn differently depending on who's who's writing the information and how that information is presented.

  • So you may be a more visual learner where only you need is something like a spread sheep.

  • You may need something explain to you mawr in depth.

  • And so it is important.

  • Understand that as you're learning these things, just going to Google and finding particular websites that explain things to you.

  • The best is really the easiest way to go.

  • So again, we're talking about data types that types or specific things.

  • But how you could get that into your head might be a little different for everybody.

  • So you just plug in my sequel data types here.

  • I found this one little my sequel tutorial.

  • This basically looked like a decent little cheat sheet to give you an idea of the different data types, and there are a lot of that types, so you have char bar chart, tiny text, text, blob, medium text, medium blob, long text, long bluff, tiny and small, and medium it and big and float double decimal date, date, time, time stamp time and new set bullion, which isn't really bully, and it's actually a tiny end, but this gives you an idea of just some.

  • Is this so literally?

  • This is some.

  • This is a few.

  • This is a couple off the different data types that are available for you on.

  • So basically what the data types, you have the type of data you can put in.

  • So basically, is it a total Alfa in America?

  • Can you put in numbers and letters?

  • So for char bar char is that only numbers?

  • So basically again, with its ends or floats, you can only put in numbers.

  • Is that whole numbers, or is it decimal point numbers so on into tiny into small and medium and those of the whole numbers?

  • So 10.

  • A 1,000,010,000 of their ends where as a float or a decimal, would be 10 not 99 or $11.25 or 1,000,026 250.33 type of thing if you go and you take a look at a speck thing, what this is telling you is basically how many characters can you insert into the values for his char going 0 to 255 characters for a tiny text, the same for a small, and you can go from anywhere from a negative 1 28 to 1 27 on.

  • Basically, this just gives you an idea of how much information that you can put in.

  • So for a lot of values that you're gonna be starting out with for for your particular projects, thes these numbers probably won't matter a lot.

  • But as you start putting in a larger individual pieces of data into a single value, this may may cause you some issues.

  • Here we come down, we can take a look again.

  • My sequel, numeric data types so tiny and small and medium and the end of the big into the decimal that float the double bits.

  • Eso those were some different numeric types.

  • We come down here to the strings, so strings or things like names, names, sentences, subject lines, messages.

  • Whatever else jar of arch are by bin by binary tiny blob.

  • So these are kind of cool.

  • The blobs.

  • I like the blobs eso I do a daily talk show or slightly daily talk show called The Daily Blob, or, I guess, kind of ramble about random things that I want to talk about and and where the name for the Daily Blob came from is the blob data types.

  • The blob data type means you can literally put almost anything you want into the database.

  • Not only did he put text or numbers or strings or whatever, but you could put MP three pot files.

  • You could put PdF files.

  • You could put movie files or whatever else.

  • You can actually put files directly into a database, though with the blobs.

  • This is one of those things where again, what is technically possible and what is an acid only stupid idea can be the same thing.

  • What people have found out over the years is generally not a good idea to put files directly into a database.

  • Because remember, with the database, you have to think about things like how you're gonna back up the database replication strategy.

  • So we have a database that has to replicate the data to two other database servers, right?

  • So if you put large files into the database itself, that could be turned into a complete mess from an architecture standpoint.

  • So what people have realized is a better way of doing things is you store a file onto a file server and as a sand or whatever else, and then basically, you put the link to the file in the database, and then the database system only has to replicate the link.

  • It doesn't have to replicate the file itself.

  • So your storage solution is what you use to make sure that your files get backed up on your finals, have replication and all that in the database.

  • You just have a link.

  • And so then it makes it easier from the database architecture standpoint, but you can have blobs.

  • There you go to tech, tiny text, text someone so forth again, things were like time.

  • So can we talk start time about things like time data types again?

  • What?

  • What type of time do you want?

  • Input it as a value of your database.

  • You just want the date, so it gives you the value for the date you want.

  • Just the time you want time date stamp time stamped like this.

  • You just simply want the year again.

  • These are things to be thinking about when you're gonna be building out Ariel Database solution and then you've even have things like my sequel.

  • Spatial types.

  • So basically for things like oh, shapes and that kind of thing.

  • You actually have data types for that.

  • So this is again, this is one of those where you could just use this is kind of like a notebook.

  • You're sitting there.

  • You're designing your little your web application.

  • You know, you're you're looking, you're looking at the field, and so basically, basically, you're creating your little input form and say you're taking okay, This is the first name the last name on the Social Security number.

  • All this information and what you can do is with all those different fields you can then go to a little little site like this and you can say, Okay, well, this needs to be this and this needs to be this.

  • And this seems to be this is an end.

  • This is a time stamp, and that's all that.

  • And then you go.

  • And when you're actually building, you're my sequel database, then basically has just just paint by numbers, which really is how most of coding and most of technology actually works.

  • Then if you really want to get in the weeds.

  • You can go to the my sequel reference guide.

  • So, basically, if you go to Devon, not my sequel dot com, they have the reference manual for my sequel.

  • Eight point.

  • Oh, now it is important.

  • I don't think I actually think I forgot about talking about this and the other classes.

  • My sequel is a piece of software.

  • So just like other pieces of software, whether it's a server operating system or whether it's exchange or anything else, there's versions.

  • You know.

  • There's newer versions, and newer versions have features that other versions don't have, or they deprecating features that previous versions did have.

  • And so the current version of Ice Equal Time Showing You Folks is my sequel.

  • Eight point.

  • Oh, so if you're using a legacy system, so let's say you have a database server has been running for five or six years.

  • You make there's a good chance you're running an older version of my sequel.

  • So just realized with things like data, tights or other things that I show you, you were version of.

  • My sequel may differ, so you may have to go to my sequel reference guide for a 5.0 and again, they may have slightly different out of types than what's available for for eight point and that can.

  • That can cause a problem, Right?

  • So if you're doing front and developments, your coding assuming data types exist when they don't actually exist, that can run into some problems.

  • But it was you come here to reference manual and this is where you can really get in the weeds, right?

  • This explains just so much so much so we could go here like numeric data types and just really starts explode.

  • It starts explaining the difference between imagers and small ends and decimals and all that kind of thing.

  • And one of the important things to be looking at is again get a little bit more information on how these these data types work in the real world, especially if you're walking in behind somebody else.

  • And they, perhaps they per cans got a little too specific with her data types because, remember.

  • But one of the one of the points of the data type is to constrain the type of data that can go into a value and a cop into a column so that you don't run into problems later.

  • Well, one of the issues is when somebody's initially Cody now on a database setting up the database, they may be a little bit too restrictive and then things as things grow as as things get modified, you may start running into problems, and you may not know why you're running into those problems eso like with this.

  • So they're talking about decimals, So decimals is a type of data type on, so they're creating a salary value and that salary value is going be a decimal.

  • And if you look here basically five, what five means is a total number of digits and in this particular number, so could be 99999 or could be 999.99 or could be 9999.9 or could be 9.9999 Right?

  • So basically, this first number here is how many digits how many numbers could be in the entire number.

  • And in the second digit here, number Here is how many places past the decimal point.

  • Are you going half?

  • So for this it's too so again so you could have 999.99 you could have