Data Types

John Elder
A free video tutorial from John Elder
Founder of Codemy
4.5 instructor rating • 58 courses • 148,772 students

Learn more from the full course

Learn SQL with Microsoft SQL Server

Understanding Databases and SQL

01:54:49 of on-demand video • Updated November 2020

  • Understand and Use Databases
  • Understand and Use SQL with Databases
  • Know How To Install and Use Microsoft SQL Server
English [Auto] Okay in the last video I mentioned that each of the records and each of these columns has to have the same type of information inside them like this one has to have numbers. This one has to have text right. So the things in these fields are data and they have to be of the same type. So in this video I want to talk about data types and there are really just a few main data types that you have to sort of learn about and they either relate to them the data being text or the data being numbers. There are a few other ones as well. If we come to Google and type in sequel data types we see right up way right away here we get this list. Let's take a look at that. And the thing about sequel data types is they change based on which database you're using. So we're going to be using Microsoft sequel server 2016 in it it uses specific data types. If you're using my sequel or post-grads or one of the other types of databases they're going to use different data types and they're all basically the same right. You have text and you have numbers but Microsoft sequel server might called a number a float. My sequel might call it an and it's just very subtle differences. And so there are hundreds of types of databases. And so you're not going to memorize all the different data types for all the different databases. Basically whenever you're using a specific database you're just going to look up that database so in our case I might go Microsoft sequel server data type just to get the specific one from Microsoft sequel server and see right here. Well we can go to the Microsoft doc itself. And you see there's a whole bunch of a list of a whole bunch of these different ones so let's just kind of look at these really quick exact numerics. That's a weird way of saying numbers but the big integer a number integer is a tiny number. You can label something as money label it as a decimal approximate numbers you label them as floats floats generally are like decimals like twelve ninety five. That's a decimal. That's probably a float. You can label them as dates or time for characters var car is the popular one you're going to use you can also lay the label them as text but I don't recommend you do that because you can't do some simple stuff to text that you can do to varchar. So you're always going to want to use your car in car and Anvari car and that basically means it's Unicode. And what Unicode is is basically different alphabets of different languages might have different characters and Unicode will deal with those different characters so if you're if you're speaking in Russian they have different a different alphabet. A Japanese uses different symbols and things like that. Unicode will deal with those. Otherwise you could just use the regular characters not have to worry about Unicode I don't usually use Unicode binary other types of data. So this is not a great looking list. Let's look at this one right here. See if we can find a better. So this is Microsoft Access. My sequel see trellises on a sequel server. Now here's a nice little chart. So we have car var car var car means variable character and this and we'll see this like you can designate exactly how big you want your characters to be. So like zip code is 1 2 3 4 5 5 characters so you might designate this to only be able to put in five characters and if you did that's what you would put that right there. And we're going to see how to use all these things. So if you don't understand what you're looking at at this point don't worry about it in the next couple of videos. This all become very obvious as we start to use these things. Textarea remember I said you shouldn't probably ever use text See want us to have an image if you're going to upload an image into your database. You might set it's data type as image. And we have here as integer allows whole numbers between negative 2 billion and positive 2 million. If you want to have bigger numbers you can use big INT decimals. You said money float real numbers. And then there's some interesting kind of weird ones. Date time date and time. I tend not to use those. You might use date though and some other ones down here that you'll probably absolutely never use. So just sort of get from this video that each of these columns you have to designate what type of data will appear in that column and then throughout the entire rest of the column that same data type will apply to everything you put in that column and we'll see very soon how to actually do all this. This is more just sort of a concept something to keep in mind as we go forward. So those are data types. Those are database concepts. So in the next video you will download Microsoft sequel server and we'll start playing with this thing.