Placeholder Image

Subtitles section Play video

  • 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 ah 100.10 right?

  • And so this get this could be an issue for you is what happens if things were starting.

  • Let's say you created something that's gonna auto tabulate.

  • And so what happens if you get to a place where it flips over and now it's 1000 0.99 right?

  • So now that would be 66 numbers, six digits trying to go into that value slot.

  • And you may run or you will run into a problem because this will only allow for five.

  • And so those are some of the things that you need to look into with these data types and basically figuring out exactly you know what, what the data type allows you to do again with things like numbers.

  • How many decibel points, how many total digits, the whole nine yards, and then think about how that will work into the future.

  • And then if you start running into problems with your own system, it may be a little issues like this that's causing you problems.

  • So now they have a better idea of what data types are now we need to start talking about validation on the front end and database big knowledge moments to the front and so that you don't run into major problems when you start designed your application.

  • So as I talked about before, literally the worst thing that can happen to you with a databases and when the wrong type of data is put into the wrong field and then you have something such as adding up or basically have any kind of mathematical algorithm run and basically you can get a complete mess.

  • So you know, one plus two plus five plus bomb plus sue plus six plus eight plus nine plus 10 divided by Tim is not something you ever want to have happen.

  • So what you want with the, uh, with these data types and the values in your database is basically you want to make it so that you can't get the wrong type of data into a particular field, and then that will mess everything up again.

  • When you're dealing with small databases, right, you have 10 records or 100 records.

  • You may look at this like that's fine.

  • It's not that big a deal, but you start talking about databases with millions of records.

  • And again, one person, one of your front and developers does something just one man things stupid and then puts a Bob who plays a Bob should never be.

  • And then all hell can break loose, right, so that that's the important reason for why you need to define these data types.

  • But then you need to start thinking about It's like, OK, so we want We want the database.

  • We want the database.

  • So if a record is being put into the database with the improper data types, we want that to fail out.

  • But when you need to start thinking about when you're developing, your application is realize that there's two components to your application.

  • We will talk about the back end, and then we talk about the front end.

  • So we want the back and to fail out.

  • So basically, if somebody tries to put Bob into an age column, we want that to fail out.

  • One of things you have to be thinking is okay, Well, what are we going to do on the front end about that?

  • Right?

  • Because I want a big issues when you're when you're designing software when you design in applications is you can have things fail silently.

  • So basically somebody puts in information the database component fails it out.

  • But if there's no acknowledgment, if there's no acknowledgment from the database back to the front end, then then the user doesn't even know it happened.

  • Right?

  • So So think about how many times you've plugged in information you've gone through.

  • You plugged out a whole form, you've hit the submit and then you just get a white screen.

  • Oh, your dad Oso did it go in?

  • Do you have to read you what you did Didn't not go in?

  • You're not really sure what happened, right?

  • So when you're designed your front end, the first thing that you need to be thinking about is what is called form validation.

  • It's what form validation is is you use a programming language such as Java script.

  • So a job, A script, basically in real time.

  • It's a client side.

  • Ah, scripting language.

  • So in real time, it can view the information that you're putting into a form and it can tell what type of data type it ISS.

  • So, basically, if you have a little box, and that box says age and you try to type Bob then Java script, depending on how you coded it can make that little box turn red or can do other things to, say, your put your trying to put the wrong type of data into this particular field again.

  • If you have a first name and you put in 12 you can have a little red box show up using Java script to say you're trying to put the wrong type of data in this field.

  • Now when you're looking at four invalidation again form validation to be done by any number of different programming languages.

  • Sometimes it can be done, MME.

  • Or less real time with something like Java script.

  • So Java script, his viewing, all of the different fields, as you put the information in.

  • If if it looks like what is supposed to look like you get the green, everything's fine.

  • If not, it will fail out.

  • Other times they got form validation with PHP or ruby or something like that, where you hit the submit button.

  • When you hit the submit button, a validation process goes through, looks at all the different fields verifies that all the different fields are the type of data that they're supposed to be.

  • If they are, then submits the information in the database.

  • If not, it just just re shows you the form, and that's where you'll see the form.

  • Pop up again and you'll have red boxes.

  • You have asterisks where you'll have something like that.

  • So when the first things you need to be thinking about if you're gonna be designing that front end is basically that form validation so that people basically that's a whole thing with data types and all this kind of thing.

  • Is it supposed to like multiple levels of security?

  • It's possible multiple levels of protection.

  • And so the first level is the form validation, trying to make sure the users don't actually submit anything to the database That's incorrect.

  • And then once it gets to the database and then making jam, making sure on the database side that the database doesn't actually accept that crappy information, then after the other form, validation and everything gets sent to the database, the other thing you need to code for the for the front end is some kind of acknowledgement from the database eso this Israel see with different types of code, basically some kind of, you know, okay or whatever acknowledge from the database.

  • So, basically, if if the record gets inputted into the database properly, then that sends an acknowledgment back to your front end.

  • That says everything's okay.

  • And that's where let's say you make a purchase on the retailer and then it shows you the receipt, right?

  • So you plug in all the information you plug in the things you want to buy, you plug in the credit card information that gets submitted to the database, it goes into the database, things get processed, how they are, and then you get an acknowledgment back.

  • Basically, your website is getting acknowledgement back saying everything work, and then you get a receipt.

  • And so you know that the whole thing went through on the up.

  • Conversely, though, if there is a problem for some reason, so maybe maybe for some reason that they're the records weren't inputted into the database.

  • Maybe maybe there's some random ass problem other than just simply the form validation, right?

  • There's some quirky issue with the database or some corporate issue with the network.

  • Whatever else, the form was able to connect with it out of a server, But when it tried to input data into the database server, it failed.

  • Then you wanted acknowledgement from the database server to say it fail, right?

  • You know, how many times have you sat there?

  • You filled out a form.

  • And again, there's no there's no reds.

  • Everything's green.

  • Everything looks fine.

  • But then when you go to submit it, you will get some kind of error.

  • That said, for whatever reason, the submission process failed.

  • And so you want some kind of acknowledgement from the database server from from the infrastructure that you've created because of one of the worst things that you can have in the real world is basically what's called a silent, a silent fail.

  • So what a silent fail is is where you submit information to the database, and then, for whatever reason, it doesn't go into the database.

  • But you also don't know that it didn't It didn't go into the database to see you think everything's okay, and then chaos will ensue in about a week when somebody's not received their order or whatever else, so you don't you don't want anything to fail silently.

  • If it's gonna fail, you want to know that it's gonna fail.

  • So those are some of things be thinking about again from that front and back in perspective.

  • And again, this is where it becomes very important to understand that that really again when you're dealing with a lot of these Web applications or native APS, you know, with these database back ends that the front end and the back end really are two entirely separate worlds, right?

  • You can have somebody there are there are there are codes that all they do is they code for the front of the coders that all they do is code for the backyard.

  • And if those two groups and those two groups are not communicating and making sure that what they're building plays nice with each other, you can run into some massive issues.

  • So that's a basic introduction to data types in the my sequel world basically data time to the mice Equal world.

  • We're just like the data types.

  • You will be using the most coding languages, right?

  • You said you set what type of variable you're dealing with on.

  • Then, from that point on.

  • That's the only value that you're able to you so again, whether it's end, whether it's characters now, whether it's blobs, whatever else, you just figure it out in the beginning, and then you just go from there again.

  • This is one that reasons why it's very important to really think about how your design in your database, because when you build the database, the idea is, is when you build it once, as Bill, you really shouldn't be messing around a lot with a schema and what type of data that that database is able to take in.

  • Because any time you try to modify the database, you may.

  • You may create problems that you're not expecting.

  • So it's very important to really sit down at the design phase and really be thinking about Okay, what data is it that I really need, like really think about that too again, when you're thinking about a number you know is that a number is at an end?

  • Is it just the whole number 10 102 100?

  • Is it is it a number of the decimal point, so should be afloat?

  • Or should it be a decimal?

  • How many decimal points do you want again?

  • So if you're dealing with prices, you only want to decimal points.

  • You're dealing with some kind of math equation type stuff.

  • You may want 20 decimal points right again.

  • This isn't there's no right or wrong, and that's the important thing.

  • Important thing to understand is there is no right or wrong answer.

  • From a technical standpoint, it's what you decide.

  • And so you go in there and you code out all of this and you create the data types on then from there, hopefully that should prevent the wrong type of data being able to get into your system, Theis you.

  • That you run into, though, is just like with firewalls, just like with any other security measures.

  • If you if you can figure things to be too tight.

  • If you configure things to be too restrictive, you may run into problems in the future that you were not simply expecting again, like with that whole decimal data type, where you can say how long the number should be.

  • So whether it's five digits or six tickets or 10 digits or whatever else, right, so you may.

  • You may be thinking you have a small company.

  • So the largest number you will ever deal with is, you know, a five digit number.

  • A six digit number.

  • What happens if that company started growing and start Company starts to grow.

  • When you start getting sales people, you're doing work orders and you're doing sales.

  • And all of a sudden again, if you're doing some kind of auto tally thing or something else, you know, when you flip over from being a five digit number two being a six digit number all of a sudden you may crasher database.

  • You may crash your system literally because, you know, five years ago, when you're you're coding up your database, you're like the most digits you know, the most digits we're ever going to use five days.

  • We're never gonna be to a point where we'll need any more than five digits for whatever number scheme that you're dealing with.

  • Um, I don't get six digits.

  • It could be bad.

  • So just kind of kind of keep that in mind.

  • Um, and again, with this type of thing, there are a lot of different data types out there again, whether using end, sir, floats or whatever else go out to the research.

  • Just think about what you need to D'oh on.

  • Then just plug it in again.

  • Really?

  • This really is one of those paint by numbers.

  • Okay?

  • I need I need an age.

  • So if it's an age, it's gonna be an ends.

  • If it's a price, maybe it's a decimal point or float.

  • It's a name, right?

  • So it really is a paint by numbers.

  • This isn't This isn't some genius thing.

  • In order to understand it, you just sit there.

  • You look at the form, Okay?

  • This is the information that I want to take in.

  • So age will be And this will be this that this will be this and this will be best.

  • And you go from there, uh, itself.

  • That's really that's just brief introduction for you.

  • So, as always, I enjoy doing this video and look forward to seeing the next one.

  • Apparently, the type of content you just saw is not what Susan W.

  • Wants for the future of YouTube.

  • This means that recommendations by YouTube to this channel have dropped massively, and views are becoming a comically small.

  • I hate to ask.

  • I used to say I would never ask.

  • But if you could subscribe like common and most importantly, share the videos that you appreciate, that may help slow the death of this channel.

  • Do you remember that?

  • If anything at all happens to this channel, you can go to Eli, the computer guy dot com, to view the content and access information not available on YouTube.

creating these classes requires equipment and service.

Subtitles and vocabulary

Click the word to look it up Click the word to find further inforamtion about it