MySQL 23 - Intro to Data Types

submitted by mkenny400 on 03/20/18 1

Every column within a table has to be given what is known as a data type. A data type is a fairly simple concept when you dissect the word. It is literally the type of data. Why do we use types, though? The biggest benefit is so that MySQL knows how to interpret and work with our data. It also makes the database better at rejecting incorrect data. If we had to concept of a data type, there would be a lot more work involved in forcing data to be of the right format. It would also be harder for us to get the database to treat the data in the correct way. In addition to this, a database can optimize storage and performance for a column if everything is of the same data type. Because of this, each column can only support one data type. There are numerous different data types in MySQL and it helps us if we categorize them. We could say that most of the data types are either: String, Numeric, Temporal Now, there are few more categories we could make, but these are the main ones. We will worry about the other ones another day as I am only introducing the topic. A string data type is anything within quotes. Most databases use single quotes for string data. Inside of the quotes can be any number of characters. What is a character? Think of any letter, number, or symbol you can type. Some people call these letters, numbers, and symbols alphanumeric. Numeric data type includes only numbers. These data types are often used for data that you plan on using for mathematical calculations. Temporal data types are data types that are used for dates and times. Now, each data type is probably going to have some options you'll need to worry about, but one that comes up with every data type is storage. The reason we need to consider storage is because we may end up with millions of rows in a table and the difference between a few bytes for each row will make a huge difference when we look at the whole picture. When a data type gives you the option of size, you will want to choose a size that will be able to hold what you need, but nothing more. In the upcoming videos we are going to discuss the available data types in more detail. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Leave a comment

Be the first to comment

Collections with this video
Email
Message
×
Embed video on a website or blog
Width
px
Height
px
×
Join Huzzaz
Start collecting all your favorite videos
×
Log in
Join Huzzaz

facebook login
×
Retrieve username and password
Name
Enter your email address to retrieve your username and password
(Check your spam folder if you don't find it in your inbox)

×