Database Design 40 - Data Types — Transcript
Full transcript
- 0:00hey guys welcome back this video we will
- 0:02be
- 0:02discussing data types I almost forgot
- 0:06there anyways what a data type is is
- 0:08when you create a
- 0:10column every single value in that column
- 0:13has to be of a certain data type so you
- 0:17need to tell that column when you create
- 0:19the database what data type it is to be
- 0:22also when you're designing you usually
- 0:25put the data types there as well so that
- 0:27way you have an idea of how your
- 0:29database is going to work work so
- 0:31there's three main categories of data
- 0:33types and the naming conventions or the
- 0:36names of these data types from one
- 0:39database management system to another
- 0:41database management system might vary a
- 0:43little bit but in general they're
- 0:45organized into three main kinds that's
- 0:49date numeric and
- 0:53string so basically we're going to be
- 0:56going over these in a little bit of
- 0:57depth we're not going to go super in
- 0:59depth because right now you just need to
- 1:01understand what these are and just
- 1:03understand that your database
- 1:05application might be slightly different
- 1:07from others let's start from the bottom
- 1:09up just to make things fun string string
- 1:12is any characters or like letters so
- 1:16basically you put these within quotes
- 1:19so
- 1:22hey this is an example of a string even
- 1:25a number within quotes can be used as a
- 1:28string and this this would be used as a
- 1:31string basically
- 1:33the uh the three doesn't have any
- 1:36mathematical value unless it's converted
- 1:39to
- 1:40numeric within string you'll often have
- 1:43some subcategories you'll have something
- 1:46that's either Char or varchar which
- 1:50those just mean character or variable
- 1:53character what that means is it's just
- 1:56like um a list of characters the
- 1:58character or char
- 2:00usually is stuff that's set in length so
- 2:03like a phone number or a zip code
- 2:05something that doesn't change sizewise
- 2:09so basically with a Char you'll you'll
- 2:10have it something
- 2:12like CH 8 and every single value within
- 2:18that Char column is going to be stored
- 2:21as a individual characters now even if
- 2:24you don't put eight characters let's say
- 2:26you put six then there's going to be two
- 2:28blank characters in there so they're all
- 2:30stored as eight varar on the other hand
- 2:34is variable basically meaning that the
- 2:37size can change you can have anywhere
- 2:39from zero up to eight there's also often
- 2:44the subcategory or subd dat type of text
- 2:47which is often used for larger things
- 2:50such as comments messages and so forth
- 2:54that's basic summary of the string data
- 2:57types as for numeric data types
- 3:00these are
- 3:02numbers that's different than this this
- 3:04is a string that has a number in it
- 3:07that's used differently than the numeric
- 3:09data type the numeric data type doesn't
- 3:12have quotes it's just the numbers that
- 3:15you're using just like string there's
- 3:17often some subcategories of decimal and
- 3:20then floating point or
- 3:22double
- 3:23decimal Works in base 10 now I know we
- 3:28haven't really gotten much into
- 3:30bases and I'm just going to put date
- 3:32back up here since we haven't got that
- 3:35yet but I think it's really important to
- 3:37know and in fact I've made a lot of
- 3:39videos over binary hexadecimal and stuff
- 3:42basically different numbering systems
- 3:44that use different bases well decimal
- 3:47uses base 10 it's the number system
- 3:49we're used to counting in you know 0 1 2
- 3:523 4 5 6 7 8 9 and then it goes back to
- 3:5710 11 12 13 14 if it's base 10 that's
- 4:01what de means in decimal well there's
- 4:04also
- 4:05binary so we
- 4:08have decimal and then we have a
- 4:12binary decimal is base 10 binaries in
- 4:15base two so binary we only have the
- 4:19options of zero and one now you don't
- 4:22really need to understand how to like
- 4:23calculate in binary but if you want to
- 4:25know that I do have videos for that but
- 4:27just know when we're working with
- 4:28decimal it is working with a base 10
- 4:32system when we're working with floating
- 4:34points we're working with binary which
- 4:37is stored differently it's stored in
- 4:39binary and then you can have it
- 4:41presented as decimal for math or
- 4:45whatever so what's really the difference
- 4:47do you use decimal or do you use
- 4:49floating
- 4:50points it just kind of really depends
- 4:53decimal generally is more accurate on
- 4:57mathematics to a point there are
- 4:59problems that can come up with decimal
- 5:01but you'll just have to research those
- 5:03but
- 5:04basically uh this one has some errors
- 5:07binary it has problems with certain
- 5:10mathematical equations or numbers for
- 5:14example when we want to store
- 5:181/4 it's stored like this we have
- 5:230 Z
- 5:25one and the way this kind of works is we
- 5:28have anything after the
- 5:31point that divides the number basically
- 5:36in half so we would have half but we
- 5:38don't have half so we have half of a
- 5:40half
- 5:411/4 kind of makes sense so the the place
- 5:44values would be this one right here
- 5:47would be uh we'd have
- 5:49half this place value would be 1/4 and
- 5:54then anything after that would be
- 5:571/8 and anything after that would be
- 6:00116th so right now way we have it we
- 6:04would take 12 multiply it by 0 to get
- 6:09zero because we don't have anything
- 6:10there we take 1/4 multiply by one since
- 6:13we have it there we' get 1/4 0 0 we add
- 6:18those up we get 1/4 basic uh adding and
- 6:23multiplying to understand how it works
- 6:26but when we have a number such as
- 6:280.1
- 6:31in decimal that is basically impossible
- 6:35to store in binary simply because we're
- 6:38working in a base 2 system and we can't
- 6:42get 2.1 very easily because 1/8 that
- 6:46doesn't quite cut it you'd have to
- 6:48basically have a combination of a bunch
- 6:51of different fractions to get as close
- 6:53as possible 2.1 but you can never really
- 6:55get there perfectly so that's a problem
- 6:57with the floating points
- 7:00so if you needed to store something like
- 7:01that you would if it needs to have that
- 7:04accuracy you would have to have it
- 7:05stored as a decimal which stores it
- 7:10differently that was a lot sorry if I
- 7:12completely overwhelmed you with that
- 7:13number stuff and if I did don't even
- 7:16worry about it that was a little too
- 7:17fast if you need it slower please check
- 7:20out my introduction to Binary video it's
- 7:24a super long video where I basically
- 7:26explain it step by step so you
- 7:28understand and then I have a couple
- 7:30other videos adding and subtracting and
- 7:32also fractions in a binary you will also
- 7:36have an integer type which will only
- 7:38store numbers that don't have any
- 7:40decimals after them so only whole
- 7:42numbers like 5 12 28 52 so forth with
- 7:47numbers we also have to worry about
- 7:48whether they are unsigned or signed if
- 7:51they are unsigned numbers that means
- 7:53that they can't be negative if they're
- 7:55signed that means they can be positive
- 7:57or negative you're probably wondering
- 7:58why would you ever do that well if
- 8:00you're working with something that
- 8:01doesn't go negative well then you
- 8:03wouldn't need to have that negative when
- 8:05you have a signed number and it can be
- 8:07positive or negative the range of
- 8:11potential values stays the same but
- 8:14since you include negatives the maximum
- 8:17value is different it's not as high
- 8:21think about if you have a range from 0
- 8:23to a
- 8:24th000 but then you include negatives now
- 8:26you have from 500 to 500 that is going
- 8:29to be told with the data type so you
- 8:31might say something like
- 8:34double
- 8:36unsigned that would work as a number
- 8:39that's enough for numbers I don't want
- 8:41to talk about this anymore let's talk
- 8:42about dates dates well there's couple
- 8:46different things you need to know about
- 8:47dates there's date then there's time
- 8:51there's date time and then there's
- 8:53timestamp so let's talk about date time
- 8:55first because it makes sense the best it
- 8:58basically just stores a dates such as
- 9:00you know 02 for February then you might
- 9:03have a colon you might have 22 for the
- 9:05date 22nd and then a colon maybe
- 9:101998 for 1998 the year then you have the
- 9:14time which could be whatever it could be
- 9:1712 30 22 which would be the seconds and
- 9:21you might even be able to have some
- 9:22milliseconds or micros
- 9:24seconds that's how you would store a
- 9:26date time the way it actually looks
- 9:29might vary from database management
- 9:31system to database management system
- 9:33some might have colons between the
- 9:35numbers some some might have hyphens or
- 9:38commas or whatever doesn't really matter
- 9:40I don't want you to think about that
- 9:41right now I just want you to think about
- 9:43the date being a date and the time being
- 9:47a time date time being the combination
- 9:50of a date and a time that's pretty much
- 9:54that for dates the only other thing is
- 9:56the time stamp the time stamp is an ex
- 9:59exact moment in time that's recorded to
- 10:02establish when something was created or
- 10:05done it can be in milliseconds or it can
- 10:08be in the month and the day and then the
- 10:11second hour and then the seconds and
- 10:13then the milliseconds or it can just be
- 10:15a number of seconds so forth it varies
- 10:18but anyways that's going to give you a
- 10:20number when something was done it's
- 10:23usually for something like when an
- 10:25account was created or when a
- 10:27transaction was done or when something
- 10:29happened when you update a column that
- 10:32Tim stamp will often
- 10:34update and that's going to keep it to
- 10:37like when that row was entered into the
- 10:41database so if you enter a new row and
- 10:44one of the columns is a timestamp it's
- 10:47going to give you a value as soon as you
- 10:49submit that and it's put into the
- 10:51database the timestamps created and it
- 10:53says okay this row was entered at this
- 10:55time that's the main thing with um
- 10:57timestamps so so basically we got three
- 10:59types of data types we got
- 11:02string um numeric and then date all of
- 11:06those classifications have different
- 11:09data types for each one but in general
- 11:12as long as you know like the gist of
- 11:14what is what you'll be fine you don't
- 11:17have to worry too much because when you
- 11:18get in actually programming a database
- 11:20you will have more specifics on what
- 11:22data types to use so you guys thank you
- 11:25for watching sorry for rambling in this
- 11:26video is a long one
- 11:29peace out
About this transcript
This page contains the full transcript of Database Design 40 - Data Types by Caleb Curry, generated from the public captions YouTube serves with the video. The transcript has 1,773 words across 263 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.