### Introduction to SQL

Course
Time
7 hours 36 minutes
Difficulty
Beginner
CEU/CPE
3

### Video Transcription

00:00
I welcome back to Module three sequel programming.
00:03
This is Lesson one sequel statements,
00:06
and we're currently in sub lesson, 1.7 data types,
00:10
and in front of us, we have a chart from my sequel tutorial dot org's I will Have an Equivalent available for download. But this comes from the My sequel Documentation. So it'll be the same now. What is a data type? Well, that types exist in most, if not all, programming languages. It's a way for you to indicate what type of data
00:29
that specific variable is and how you expect the engine or programming like language to work with that data. For example, when we tell a programming language that this is an imager,
00:40
that's different, and we expect different operations to work. Then when we say this is a string or a character or text,
00:46
when we add text together, that's very different than adding images together and the outcomes of those air different. And when we tell
00:54
the program Leijer what Dad attacked to use, we're telling it how much memory space to use for that data type as well.
01:00
For example,
01:02
when we indicate an imager,
01:06
we're told that we can use a negative number that could be a small. Is this highlighted number
01:11
and a positive number that could be as big as this highlighted number
01:14
and
01:15
put that into a binary conversion. And these come from binary numbers, which are
01:21
come from the fact that appears on Lee. Think in ones and zeros. Right now we'll see that we'll get this number back,
01:29
which is 31 bits
01:30
with a 32nd. But that represents that it's positive or native. For example, the positive variant has zero here. The negative Arent has a one here
01:41
now, just to kind of very simply state how big numbers work. And we have a two bit number. We can represent four numbers. We have a three bit number, could represent seven numbers and so on and so forth. That's why when we get to this size, we can represent a very large number, which is way too many numbers to really plot out all of them.
02:00
So the fact that has is that we know that this is a 32 bit number we know when we tell my sequel. Hey, this column type is imager. My sequel saying, Okay, I'm gonna use 32 bits of space for every record you add for this number. When we had a record and we save data to that column with an energy type,
02:19
we're using 32 bits of space,
02:21
whether we put in the largest number or we put in a five. The same thing with big imager is that whether we put in a five or the largest number it supports were using that amount of space,
02:32
which I believe this is 64 bit, but I'm not completely sure I'd have to look it up. The point is, it takes the big end takes up a lot more space than the manager. The reason we would use imager instead of big editor
02:45
is because imager takes up less space than big manager, so this may not matter as much in a smaller application. But as your application grows to thousands, millions or billions of records, amount of potential wasted space from a port datacom decision grows as well.
03:04
For example, if you were using a
03:07
ZIP code as a column and you made it a big ends, and we know that zip codes do not get to this size and that we would have been fined using a regular imager type. Then we're wasting a lot of space because every time you save a record, it uses the amount of space that this largest or smallest number will could potentially take up.
03:27
The same thing occurs with Char's bar charts and tax. If you use more than what you need, you end up wasting space, and that waste gets worse and worse as you go along.
03:37
For example, if you're saving the state code and you know state codes are only two characters long, you could put chart, too.
03:45
But if you put Char 2 55
03:50
then the database engine is saving on others, using enough memory space to support up to 255 characters, whether you use it or not. So again, it ends up wasting spiff. So as you develop your programming skills, you'll want to take in consideration what data type you're using and what size of data you need.
04:09
So that brings this lesson to a close. We went over my single data types, why the airport and and why you would use manager instead of big manager or flow instead of double. It comes down to how much space you think you're going to need for that data type. If you are interested in being efficient and you should be, you should try to use what you're going to
04:28
04:32
Then you should be aware of what the data type is, how much space it permits and what the maximum values for that data type is.
04:40
Anyways, that brings this lesson too close. I hope you enjoyed it. And I hope to see in the next one. Thank you.

### Introduction to SQL

This introductory SQL training teaches SQL core concepts that can be applied in professional environments. Once students complete this course, they will be able to query and interact with an SQL database, and know how to design database schemas.

Kitt Parker
Instructor