SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
DataTypes in mysql
Mrs.G.Chandraprabha,M.Sc.,M.Phil
.,
Assistant Professor,
Department of IT,
V.V.V college for Women,
Virudhunagar
Introduction
A data type is an attribute that
specifies the type of data that the object can
hold: integer data, character data,
monetary data, date and time data, binary
strings, and so on.
SQL Server supplies a set of
system data types that define all
the types of data that can be used
with SQL Server.
Their types,
MySQL uses many different data types
broken into three categories.
Numeric
Date and Time
String Types.
Numeric Data Types
INT
TINYINT
 SMALLINT
MEDIUMINT
BIGINT
FLOAT(M,D)
DOUBLE(M,D)
DECIMAL(M,D)
Numeric Data Types
INT − A normal-sized integer that can be
signed or unsigned. If signed, the
allowable range is from -2147483648 to
2147483647. If unsigned, the allowable
range is from 0 to 4294967295. You can
specify a width of up to 11 digits.
TINYINT − A very small integer that can
be signed or unsigned. If signed, the
allowable range is from -128 to 127. If
unsigned, the allowable range is from 0 to
255. You can specify a width of up to 4
digits.
Cont……
SMALLINT − A small integer that can be
signed or unsigned. If signed, the
allowable range is from -32768 to
32767. If unsigned, the allowable range
is from 0 to 65535. You can specify a
width of up to 5 digits.
MEDIUMINT − A medium-sized integer
that can be signed or unsigned. If
signed, the allowable range is from -
8388608 to 8388607. If unsigned, the
allowable range is from 0 to 16777215.
You can specify a width of up to 9 digits.
Cont….
BIGINT − A large integer that can be signed or
unsigned. If signed, the allowable range is from -
9223372036854775808 to 9223372036854775807.
If unsigned, the allowable range is from 0 to
18446744073709551615. You can specify a width
of up to 20 digits.
FLOAT(M,D) − A floating-point number that
cannot be unsigned. You can define the display
length (M) and the number of decimals (D). This
is not required and will default to 10,2, where 2
is the number of decimals and 10 is the total
number of digits (including decimals). Decimal
precision can go to 24 places for a FLOAT.
Cont…..
DOUBLE(M,D) − A double precision floating-point
number that cannot be unsigned. You can define the
display length (M) and the number of decimals (D).
This is not required and will default to 16,4, where 4
is the number of decimals. Decimal precision can go
to 53 places for a DOUBLE. REAL is a synonym for
DOUBLE.
DECIMAL(M,D) − An unpacked floating-point
number that cannot be unsigned. In the unpacked
decimals, each decimal corresponds to one byte.
Defining the display length (M) and the number of
decimals (D) is required. NUMERIC is a synonym for
DECIMAL.
Date and Time Types
DATE
DATETIME
TIMESTAMP
TIME
YEAR(M)
Date and Time Types
DATE − A date in YYYY-MM-DD format,
between 1000-01-01 and 9999-12-31. For
example, December 30th, 1973 would be
stored as 1973-12-30.
DATETIME − A date and time combination in
YYYY-MM-DD HH:MM:SS format, between
1000-01-01 00:00:00 and 9999-12-31
23:59:59. For example, 3:30 in the afternoon
on December 30th, 1973 would be stored as
1973-12-30 15:30:00.
Cont……
TIMESTAMP − A timestamp between midnight,
January 1st, 1970 and sometime in 2037. This looks
like the previous DATETIME format, only without the
hyphens between numbers; 3:30 in the afternoon on
December 30th, 1973 would be stored as
19731230153000 ( YYYYMMDDHHMMSS ).
TIME − Stores the time in a HH:MM:SS format.
YEAR(M) − Stores a year in a 2-digit or a 4-digit
format. If the length is specified as 2 (for example
YEAR(2)), YEAR can be between 1970 to 2069 (70 to
69). If the length is specified as 4, then YEAR can be
1901 to 2155. The default length is 4.
String Types
CHAR(M)
VARCHAR(M)
BLOB or TEXT
TINYBLOB or TINYTEXT
MEDIUMBLOB or MEDIUMTEXT
LONGBLOB or LONGTEXT
ENUM
String Types
CHAR(M) − A fixed-length string between 1
and 255 characters in length (for example
CHAR(5)), right-padded with spaces to the
specified length when stored. Defining a
length is not required, but the default is 1.
VARCHAR(M) − A variable-length string
between 1 and 255 characters in length. For
example, VARCHAR(25). You must define a
length when creating a VARCHAR field.
Cont…….
BLOB or TEXT − A field with a maximum length of
65535 characters. BLOBs are "Binary Large Objects"
and are used to store large amounts of binary data,
such as images or other types of files. Fields defined
as TEXT also hold large amounts of data. The
difference between the two is that the sorts and
comparisons on the stored data are case sensitive on
BLOBs and are not case sensitive in TEXT fields.
You do not specify a length with BLOB or TEXT.
TINYBLOB or TINYTEXT − A BLOB or TEXT column
with a maximum length of 255 characters. You do not
specify a length with TINYBLOB or TINYTEXT.
Cont……
MEDIUMBLOB or MEDIUMTEXT − A BLOB or TEXT
column with a maximum length of 16777215
characters. You do not specify a length with
MEDIUMBLOB or MEDIUMTEXT.
LONGBLOB or LONGTEXT − A BLOB or TEXT
column with a maximum length of 4294967295
characters. You do not specify a length with
LONGBLOB or LONGTEXT.
ENUM − An enumeration, which is a fancy term for
list. When defining an ENUM, you are creating a list
of items from which the value must be selected (or it
can be NULL). For example, if you wanted your field
to contain "A" or "B" or "C", you would define your
ENUM as ENUM ('A', 'B', 'C') and only those values (or
NULL) could ever populate that field.
Mysql datatypes

More Related Content

What's hot (20)

PPTX
4. plsql
Amrit Kaur
 
PPTX
SQL Commands
Sachidananda M H
 
PPTX
SQL for interview
Aditya Kumar Tripathy
 
PPT
MySQL Views
Reggie Niccolo Santos
 
PPTX
SQL
Shyam Khant
 
PPT
SQL.ppt
Ranjit273515
 
PPTX
Sql queries presentation
NITISH KUMAR
 
PDF
View & index in SQL
Swapnali Pawar
 
PPTX
Sql commands
Pooja Dixit
 
PPT
Introduction to structured query language (sql)
Sabana Maharjan
 
PPT
05 Creating Stored Procedures
rehaniltifat
 
PPTX
introdution to SQL and SQL functions
farwa waqar
 
PDF
Sql tutorial
Rumman Ansari
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Oracle SQL Basics
Dhananjay Goel
 
PPT
Mysql
TSUBHASHRI
 
PPTX
DATABASE CONSTRAINTS
sunanditaAnand
 
PPTX
SQL - Structured query language introduction
Smriti Jain
 
4. plsql
Amrit Kaur
 
SQL Commands
Sachidananda M H
 
SQL for interview
Aditya Kumar Tripathy
 
SQL.ppt
Ranjit273515
 
Sql queries presentation
NITISH KUMAR
 
View & index in SQL
Swapnali Pawar
 
Sql commands
Pooja Dixit
 
Introduction to structured query language (sql)
Sabana Maharjan
 
05 Creating Stored Procedures
rehaniltifat
 
introdution to SQL and SQL functions
farwa waqar
 
Sql tutorial
Rumman Ansari
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Oracle SQL Basics
Dhananjay Goel
 
Mysql
TSUBHASHRI
 
DATABASE CONSTRAINTS
sunanditaAnand
 
SQL - Structured query language introduction
Smriti Jain
 

Similar to Mysql datatypes (20)

DOCX
Sql data types for various d bs by naveen kumar veligeti
Naveen Kumar Veligeti
 
PPTX
2.0 sql data types for my sql, sql server
MLG College of Learning, Inc
 
DOCX
mysql datatype______________________.docx
Ajanya5
 
PPTX
Learn Database Design with MySQL - Chapter 4 - Data types
Eduonix Learning Solutions
 
PPTX
MySql
Sukrit Gupta
 
PDF
UNIT 3 SQL 10.pdf ORACEL DATABASE QUERY OPTIMIZATION
saranyaksr92
 
PPTX
2019 02 21_biological_databases_part2_v_upload
Prof. Wim Van Criekinge
 
PPTX
SQL Commands Part 1.pptx
RUBAB79
 
PPTX
Session 2 - "MySQL Basics & Schema Design"
LogaRajeshwaranKarth
 
PPTX
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
DjTayone
 
PPTX
2018 02 20_biological_databases_part2_v_upload
Prof. Wim Van Criekinge
 
PPTX
2017 biological databasespart2
Prof. Wim Van Criekinge
 
PPTX
2016 02 23_biological_databases_part2
Prof. Wim Van Criekinge
 
PPTX
session_2 on database mysql databaseds from file to
zmulani8
 
PPTX
unit 1_unit1_unit1_unit 1_unit1_unit1_ ppt.pptx
townhallforme1
 
ODT
Sql and mysql database concepts
Selamawit Feleke
 
PPTX
MSAvMySQL.pptx
MattMarino13
 
PPTX
unit 1 ppt.pptx
VillainMass
 
PDF
Copy of MySQL Data Types.pdf
sadafali71
 
Sql data types for various d bs by naveen kumar veligeti
Naveen Kumar Veligeti
 
2.0 sql data types for my sql, sql server
MLG College of Learning, Inc
 
mysql datatype______________________.docx
Ajanya5
 
Learn Database Design with MySQL - Chapter 4 - Data types
Eduonix Learning Solutions
 
UNIT 3 SQL 10.pdf ORACEL DATABASE QUERY OPTIMIZATION
saranyaksr92
 
2019 02 21_biological_databases_part2_v_upload
Prof. Wim Van Criekinge
 
SQL Commands Part 1.pptx
RUBAB79
 
Session 2 - "MySQL Basics & Schema Design"
LogaRajeshwaranKarth
 
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
DjTayone
 
2018 02 20_biological_databases_part2_v_upload
Prof. Wim Van Criekinge
 
2017 biological databasespart2
Prof. Wim Van Criekinge
 
2016 02 23_biological_databases_part2
Prof. Wim Van Criekinge
 
session_2 on database mysql databaseds from file to
zmulani8
 
unit 1_unit1_unit1_unit 1_unit1_unit1_ ppt.pptx
townhallforme1
 
Sql and mysql database concepts
Selamawit Feleke
 
MSAvMySQL.pptx
MattMarino13
 
unit 1 ppt.pptx
VillainMass
 
Copy of MySQL Data Types.pdf
sadafali71
 
Ad

More from V.V.Vanniaperumal College for Women (20)

PPTX
inheritance in Java with sample program.pptx
V.V.Vanniaperumal College for Women
 
PPTX
System testing in software engineering.pptx
V.V.Vanniaperumal College for Women
 
PPTX
static analysis and unit testing in SE.pptx
V.V.Vanniaperumal College for Women
 
PPTX
software cost estimation techniques ppt.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Software cost factors in software engineering.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Planning the development Process in SE.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Quality and Productivity Factors in Software Engineering
V.V.Vanniaperumal College for Women
 
PPTX
Some Size factors in software engineering
V.V.Vanniaperumal College for Women
 
PPTX
Control Memory.pptx
V.V.Vanniaperumal College for Women
 
PPTX
ADDRESSING MODES.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Data_Transfer&Manupulation Instructions.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Timing & Control.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Human Rights - 1.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Instruction Codes.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Features of Java.pptx
V.V.Vanniaperumal College for Women
 
PPTX
Constructors in JAva.pptx
V.V.Vanniaperumal College for Women
 
PPTX
IS-Crypttools.pptx
V.V.Vanniaperumal College for Women
 
PPTX
IS-Delibrate software attacks.pptx
V.V.Vanniaperumal College for Women
 
inheritance in Java with sample program.pptx
V.V.Vanniaperumal College for Women
 
System testing in software engineering.pptx
V.V.Vanniaperumal College for Women
 
static analysis and unit testing in SE.pptx
V.V.Vanniaperumal College for Women
 
software cost estimation techniques ppt.pptx
V.V.Vanniaperumal College for Women
 
Software cost factors in software engineering.pptx
V.V.Vanniaperumal College for Women
 
Planning the development Process in SE.pptx
V.V.Vanniaperumal College for Women
 
Quality and Productivity Factors in Software Engineering
V.V.Vanniaperumal College for Women
 
Some Size factors in software engineering
V.V.Vanniaperumal College for Women
 
Data_Transfer&Manupulation Instructions.pptx
V.V.Vanniaperumal College for Women
 
Instruction Codes.pptx
V.V.Vanniaperumal College for Women
 
Constructors in JAva.pptx
V.V.Vanniaperumal College for Women
 
IS-Delibrate software attacks.pptx
V.V.Vanniaperumal College for Women
 
Ad

Recently uploaded (20)

PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
July Patch Tuesday
Ivanti
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
What Makes Contify’s News API Stand Out: Key Features at a Glance
Contify
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 

Mysql datatypes

  • 1. DataTypes in mysql Mrs.G.Chandraprabha,M.Sc.,M.Phil ., Assistant Professor, Department of IT, V.V.V college for Women, Virudhunagar
  • 2. Introduction A data type is an attribute that specifies the type of data that the object can hold: integer data, character data, monetary data, date and time data, binary strings, and so on. SQL Server supplies a set of system data types that define all the types of data that can be used with SQL Server.
  • 3. Their types, MySQL uses many different data types broken into three categories. Numeric Date and Time String Types.
  • 4. Numeric Data Types INT TINYINT  SMALLINT MEDIUMINT BIGINT FLOAT(M,D) DOUBLE(M,D) DECIMAL(M,D)
  • 5. Numeric Data Types INT − A normal-sized integer that can be signed or unsigned. If signed, the allowable range is from -2147483648 to 2147483647. If unsigned, the allowable range is from 0 to 4294967295. You can specify a width of up to 11 digits. TINYINT − A very small integer that can be signed or unsigned. If signed, the allowable range is from -128 to 127. If unsigned, the allowable range is from 0 to 255. You can specify a width of up to 4 digits.
  • 6. Cont…… SMALLINT − A small integer that can be signed or unsigned. If signed, the allowable range is from -32768 to 32767. If unsigned, the allowable range is from 0 to 65535. You can specify a width of up to 5 digits. MEDIUMINT − A medium-sized integer that can be signed or unsigned. If signed, the allowable range is from - 8388608 to 8388607. If unsigned, the allowable range is from 0 to 16777215. You can specify a width of up to 9 digits.
  • 7. Cont…. BIGINT − A large integer that can be signed or unsigned. If signed, the allowable range is from - 9223372036854775808 to 9223372036854775807. If unsigned, the allowable range is from 0 to 18446744073709551615. You can specify a width of up to 20 digits. FLOAT(M,D) − A floating-point number that cannot be unsigned. You can define the display length (M) and the number of decimals (D). This is not required and will default to 10,2, where 2 is the number of decimals and 10 is the total number of digits (including decimals). Decimal precision can go to 24 places for a FLOAT.
  • 8. Cont….. DOUBLE(M,D) − A double precision floating-point number that cannot be unsigned. You can define the display length (M) and the number of decimals (D). This is not required and will default to 16,4, where 4 is the number of decimals. Decimal precision can go to 53 places for a DOUBLE. REAL is a synonym for DOUBLE. DECIMAL(M,D) − An unpacked floating-point number that cannot be unsigned. In the unpacked decimals, each decimal corresponds to one byte. Defining the display length (M) and the number of decimals (D) is required. NUMERIC is a synonym for DECIMAL.
  • 9. Date and Time Types DATE DATETIME TIMESTAMP TIME YEAR(M)
  • 10. Date and Time Types DATE − A date in YYYY-MM-DD format, between 1000-01-01 and 9999-12-31. For example, December 30th, 1973 would be stored as 1973-12-30. DATETIME − A date and time combination in YYYY-MM-DD HH:MM:SS format, between 1000-01-01 00:00:00 and 9999-12-31 23:59:59. For example, 3:30 in the afternoon on December 30th, 1973 would be stored as 1973-12-30 15:30:00.
  • 11. Cont…… TIMESTAMP − A timestamp between midnight, January 1st, 1970 and sometime in 2037. This looks like the previous DATETIME format, only without the hyphens between numbers; 3:30 in the afternoon on December 30th, 1973 would be stored as 19731230153000 ( YYYYMMDDHHMMSS ). TIME − Stores the time in a HH:MM:SS format. YEAR(M) − Stores a year in a 2-digit or a 4-digit format. If the length is specified as 2 (for example YEAR(2)), YEAR can be between 1970 to 2069 (70 to 69). If the length is specified as 4, then YEAR can be 1901 to 2155. The default length is 4.
  • 12. String Types CHAR(M) VARCHAR(M) BLOB or TEXT TINYBLOB or TINYTEXT MEDIUMBLOB or MEDIUMTEXT LONGBLOB or LONGTEXT ENUM
  • 13. String Types CHAR(M) − A fixed-length string between 1 and 255 characters in length (for example CHAR(5)), right-padded with spaces to the specified length when stored. Defining a length is not required, but the default is 1. VARCHAR(M) − A variable-length string between 1 and 255 characters in length. For example, VARCHAR(25). You must define a length when creating a VARCHAR field.
  • 14. Cont……. BLOB or TEXT − A field with a maximum length of 65535 characters. BLOBs are "Binary Large Objects" and are used to store large amounts of binary data, such as images or other types of files. Fields defined as TEXT also hold large amounts of data. The difference between the two is that the sorts and comparisons on the stored data are case sensitive on BLOBs and are not case sensitive in TEXT fields. You do not specify a length with BLOB or TEXT. TINYBLOB or TINYTEXT − A BLOB or TEXT column with a maximum length of 255 characters. You do not specify a length with TINYBLOB or TINYTEXT.
  • 15. Cont…… MEDIUMBLOB or MEDIUMTEXT − A BLOB or TEXT column with a maximum length of 16777215 characters. You do not specify a length with MEDIUMBLOB or MEDIUMTEXT. LONGBLOB or LONGTEXT − A BLOB or TEXT column with a maximum length of 4294967295 characters. You do not specify a length with LONGBLOB or LONGTEXT. ENUM − An enumeration, which is a fancy term for list. When defining an ENUM, you are creating a list of items from which the value must be selected (or it can be NULL). For example, if you wanted your field to contain "A" or "B" or "C", you would define your ENUM as ENUM ('A', 'B', 'C') and only those values (or NULL) could ever populate that field.