Data type in MySQL Part - 1
Hello and
welcome everyone. In this article, we will learn about Data type and its type.
Let’s go.
C# basic course click on: https://www.udemy.com/learn-csharp-with-sagar-jaybhay/
Web API 2-
.Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/
Data type
You
optimize your database you should use the type and size of the field in your
database table (in MySQL every column in a database table is required to have a
name and a data type). A data type is a specifies the possible values for that
type, that specifies a particular data type, for example, floating points,
integer, varchar, Boolean, date and time, etc.
When
creating a table what type of data will be stored.
MySQL has
three most important data type
1.
Data and Time
2.
Numeric
3.
String
Data and Time Data type
DATE
()
DATETIME
()
TIMESTAMP
()
TIME
()
YEAR
()
Now let see
in details one by one:
DATE
()
Date
data type use you need only date information. In MySQL date format is YYYY-MM-DD and date data type range is
between ‘1000-01-01’ to ‘9999-12-31’.
Date data type storage size is 3 bytes.
MongoDB with .Net Core course link => https://www.udemy.com/mongodb-with-net-core-sagar-jaybhay/
C# basic course click on: https://www.udemy.com/learn-csharp-with-sagar-jaybhay/
Web API 2- .Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/
DATETIME
()
DateTime
data type combination of date and time and DateTime format is YYYY-MM-DD HH:MM:SS. DateTime data type
range is between ‘1000-01-01 00:00:00’
to ‘9999-12-31 23:59:59’. DateTime data type storage size is 8 bytes.
TIMESTAMP
()
TIMESTAMP
data type values are stored as the number of seconds and it converted values
from the current time zone to UTC and converted back from UTC to the current
time zone when it retrieved. TIMESTAMP format is YYYY-MM-DD HH:MM:SS and its range is 1970-01-01 00:00:01 UTC to 2038-01-09 03:14:07 UTC. TIMESTAMP data
type storage size is 4 bytes.
TIME
()
The
TIME data type is storing time values. The time format is HH:MM:SS and its range are ‘-838:59:59’
to ‘838:59:59’. TIME data type storage size is 3 bytes.
YEAR
()
The
YEAR data type stores an in a 2 digit or a 4 digit format for example YEAR (2) or YEAR (4). There are two types converted range: the first one is 70-99 are converted to 1970-1999 and the second one is 00-69 is converted to 2000-2069. YEAR data type storage size
is 1 byte.
In this
article, we are learned about Data type and Date and Time data type. We will
see other data type (Numeric and String data type) in the next article.
C# basic course click on: https://www.udemy.com/learn-csharp-with-sagar-jaybhay/
Web API 2-
.Net Core In depth In 5 Hours click on: https://www.udemy.com/web-api-2-net-core-in-depth-in-5-hrs-with-sagar-jaybhay/
Comments
Post a Comment