WEBVTT

00:00.440 --> 00:05.680
Number columns hold various types of numbers, but that's not at all.

00:05.690 --> 00:09.740
So they also allow you to perform calculations on these numbers.

00:09.740 --> 00:15.560
And that's an important distinction from numbers you store as strings in a character column which can't

00:15.560 --> 00:20.990
be added, multiplied, divided or perform any other mathematical operations.

00:21.140 --> 00:26.270
Also, numbers stored as characters store differently than numbers stored as numbers.

00:26.270 --> 00:33.260
So if you are doing math or the numeric order is important, you use number times and the number times

00:33.260 --> 00:35.630
includes the integers.

00:36.080 --> 00:37.850
Here, actually let me go to here.

00:37.850 --> 00:46.460
So number types includes the integers, integers, which these are the whole numbers, both positive

00:46.460 --> 00:47.510
and negative.

00:47.510 --> 00:55.190
In this case, for example, 12 and here this is also number here, number here, number and so on.

00:55.190 --> 00:59.630
And we also have the fixed point and floating numbers.

00:59.630 --> 01:02.640
So floating numbers.

01:02.850 --> 01:04.980
So this is the floating point number.

01:04.980 --> 01:09.930
So these are the two formats of fractions, the full numbers here.

01:10.350 --> 01:13.050
And we will look at each type separately.

01:13.050 --> 01:14.710
So we will use integers firstly.

01:14.730 --> 01:21.060
So the integer types are the most common number types you will find when exploring the SQL database.

01:21.060 --> 01:25.380
So these are the whole numbers, both positive and negative, including zero.

01:25.380 --> 01:31.710
And think of all the places integers appear in life, your street or apartment number, the serial number

01:31.710 --> 01:38.760
on your refrigerator, the number on a raffle ticket and the SQL standard provides three integer types,

01:39.630 --> 01:50.100
which is the Smallint or integer types here, which these are the Smallint Smallint integer and big

01:50.100 --> 01:51.600
integer, big Bigint.

01:51.600 --> 01:58.350
And the difference between these types is the maximum size of numbers they can hold.

01:58.350 --> 02:08.160
And here I will write that so small integer small integer is a data type that storage size is two bytes,

02:08.190 --> 02:15.150
two bytes and which the range is from minus -32.

02:15.510 --> 02:15.890
Yeah.

02:15.930 --> 02:25.470
32,768 to plus positive 32,767.

02:25.470 --> 02:33.840
And we also have integer which holds four bytes of data, four bytes of data and which these are the

02:34.830 --> 02:41.640
this number is pretty big, but it's, but it's nothing compared to big integer.

02:41.640 --> 02:43.470
So it holds two.

02:43.500 --> 02:52.800
It's from 214 and 7214748.

02:53.990 --> 02:57.850
Uh, 36483648.

02:59.450 --> 03:00.010
Here.

03:00.020 --> 03:02.630
As you can see here we have we can hold.

03:04.500 --> 03:05.640
To be

03:05.670 --> 03:12.120
2,148,483,648

03:12.150 --> 03:17.700
numbers from this number to this.

03:17.970 --> 03:20.610
Just copy this to this.

03:21.720 --> 03:22.410
Just seven.

03:23.190 --> 03:25.320
4647.

03:25.320 --> 03:28.110
And we also have big integer.

03:28.110 --> 03:33.640
And guess what the storage size of this big integer is we can measure.

03:33.960 --> 03:35.250
So I'm waiting here for you.

03:35.400 --> 03:37.230
Yeah, it's eight bytes.

03:37.590 --> 03:38.910
Eight bytes.

03:38.910 --> 03:40.310
And here this is the

03:40.320 --> 03:48.900
92233720368.

03:50.740 --> 03:56.980
(368) 454-7758.

03:57.790 --> 04:03.040
And zero eight from this number to this.

04:04.620 --> 04:07.110
Thus seven instead of minus one.

04:08.050 --> 04:08.320
Here.

04:09.650 --> 04:18.890
So the big integer type will cover just about any requirement you will ever have with the number column,

04:18.930 --> 04:21.410
although it eats up the most storage.

04:21.410 --> 04:24.740
So it is it's use is a must.

04:24.740 --> 04:32.540
If you are working with a number larger than 2.1 billion and but you also can easily make it your go

04:32.540 --> 04:36.590
to default and never worry about not being able to fit a number in the column.

04:36.590 --> 04:42.170
And on the other hand, if you are confident numbers will remain with within the integer limit.

04:42.200 --> 04:43.490
Integer limit.

04:44.340 --> 04:50.700
Uh, that type is a good choice because it doesn't consume as much space as big integer and a concern.

04:51.030 --> 04:57.720
This is a concern when dealing with millions of data rows and when you know that values will remain

04:57.720 --> 05:01.700
constrained at small integer makes sense.

05:01.710 --> 05:05.130
So days of the months or years are good examples.

05:05.130 --> 05:10.230
Then the INT type will use half the storage as integer.

05:10.230 --> 05:15.810
So it's smart database design choice and the design decision.

05:15.810 --> 05:21.300
If the column values will always fit within this range.

05:21.300 --> 05:28.500
So if you try to insert a number into any of these columns that is outside its range, the database

05:28.500 --> 05:33.720
will stop the operation and return an out of range error.
