SlideShare a Scribd company logo
1 of 7
DATABASE DESIGN
USING MYSQL
Understanding Data Types
3 CATEGORIES
MySQL offers many data types but places those data
types into 3 categories
1. Numeric Data Types
2. String Data Types
3. Date and Time Data Types
SIGNED VS. UNSIGNED
• An Unsigned data type can not be negative but
has twice as large a range than positive integers
• A Signed data type can have negative values
• The types TINYINT, SMALLINT, MEDIUMINT, INT and
BIGINT all have signed and unsigned versions.
Type Storage Min Max
INT 4 -2147483648 2147483647
INT UNSIGNED 4 0 4294967295
NUMERIC DATA TYPES
• INT – Normal sized integer. Width up to 11 digits
• TINYINT – Very small integer. 0 – 255 and a width up
to 4 digits. Synonym for BOOLEAN
• SMALLINT – Width of 5 digits
• MEDIUMINT – Width of 9 digits
• BIGINT – Up to 20 digits
FLOAT – Floating point number. Can define length
and number of decimals
DOUBLE – Double precision floating point number
DECIMAL – Unpacked floating point number
STRING DATA TYPES
• CHAR – A fixed length string 1-255 chars in length. Not
required to specify a length, defaults to 1
• VARCHAR – Variable-length between 1-255 chars. Must
have a defined length
• BLOB or TEXT – Max length of 65535 characters. BLOBs
can store large binary data like images, but I would
suggest NOT storing images in a database
• TINYBLOB OR TINYTEXT – Max length of 255
• MEDIUMBLOB or MEDIUMTEXT – Max length of 16777215
• LONGBLOB or LONGTEXT – Max length up to 4294967295
• ENUM – An enumeration which is basically a list. Use to
create a list of items for which a value must be selected.
DATE AND TIME TYPES
• DATE – A date value in YYYY-MM-DD format.
September 10th, 1981 would be stored as 1981-09-
10
• DATETIME - A date and time combination in YYYY-
MM-DD HH:MM:SS format,
• TIMESTAMP - A timestamp between midnight,
January 1, 1970 and sometime in 2037. This looks like
the previous DATETIME format, only without the
hyphens .
• TIME -Stores the time in HH:MM:SS format
• YEAR -Stores a year in 2-digit or 4-digit format.
THAT’S IT!

More Related Content

Viewers also liked

Conalep tlalnepantla 1
Conalep tlalnepantla      1Conalep tlalnepantla      1
Conalep tlalnepantla 1
abbigali
 
LILAC Highlights Themes RM LD 060614
LILAC Highlights Themes RM LD 060614LILAC Highlights Themes RM LD 060614
LILAC Highlights Themes RM LD 060614
Liz Dore
 
Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01
frans2014
 
аз жаргалтай үлгэр
аз жаргалтай үлгэраз жаргалтай үлгэр
аз жаргалтай үлгэр
Nyamzaya Gerelzaya
 

Viewers also liked (12)

Expand Your Loft Space
Expand Your Loft Space Expand Your Loft Space
Expand Your Loft Space
 
Conalep tlalnepantla 1
Conalep tlalnepantla      1Conalep tlalnepantla      1
Conalep tlalnepantla 1
 
Learn Database Design with MySQL - Chapter 3 - My sql storage engines
Learn Database Design with MySQL - Chapter 3 - My sql storage enginesLearn Database Design with MySQL - Chapter 3 - My sql storage engines
Learn Database Design with MySQL - Chapter 3 - My sql storage engines
 
Int to tourism and hospitality(1)
Int to tourism and hospitality(1)Int to tourism and hospitality(1)
Int to tourism and hospitality(1)
 
LILAC Highlights Themes RM LD 060614
LILAC Highlights Themes RM LD 060614LILAC Highlights Themes RM LD 060614
LILAC Highlights Themes RM LD 060614
 
Make an Entrance
Make an EntranceMake an Entrance
Make an Entrance
 
Article: ZELA hosts workshop on Corporate Social Responsibility & Business an...
Article: ZELA hosts workshop on Corporate Social Responsibility & Business an...Article: ZELA hosts workshop on Corporate Social Responsibility & Business an...
Article: ZELA hosts workshop on Corporate Social Responsibility & Business an...
 
Nature, the environment and energy - Nonstopielts-jen
Nature, the environment and energy - Nonstopielts-jenNature, the environment and energy - Nonstopielts-jen
Nature, the environment and energy - Nonstopielts-jen
 
Acitividad no.4
Acitividad no.4Acitividad no.4
Acitividad no.4
 
Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01
 
аз жаргалтай үлгэр
аз жаргалтай үлгэраз жаргалтай үлгэр
аз жаргалтай үлгэр
 
Pictures of earth
Pictures of earthPictures of earth
Pictures of earth
 

Similar to Learn Database Design with MySQL - Chapter 4 - Data types

Field datatypes
Field datatypesField datatypes
Field datatypes
hanuman
 
Sql and mysql database concepts
Sql and mysql database conceptsSql and mysql database concepts
Sql and mysql database concepts
Selamawit Feleke
 

Similar to Learn Database Design with MySQL - Chapter 4 - Data types (19)

2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_upload2019 02 21_biological_databases_part2_v_upload
2019 02 21_biological_databases_part2_v_upload
 
MySql
MySqlMySql
MySql
 
2018 02 20_biological_databases_part2_v_upload
2018 02 20_biological_databases_part2_v_upload2018 02 20_biological_databases_part2_v_upload
2018 02 20_biological_databases_part2_v_upload
 
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
 
2.0 sql data types for my sql, sql server
2.0 sql data types for my sql, sql server2.0 sql data types for my sql, sql server
2.0 sql data types for my sql, sql server
 
Mysql datatypes
Mysql datatypesMysql datatypes
Mysql datatypes
 
2016 02 23_biological_databases_part2
2016 02 23_biological_databases_part22016 02 23_biological_databases_part2
2016 02 23_biological_databases_part2
 
Sql data types for various d bs by naveen kumar veligeti
Sql data types for various d bs by naveen kumar veligetiSql data types for various d bs by naveen kumar veligeti
Sql data types for various d bs by naveen kumar veligeti
 
Structured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptxStructured Query Language (SQL) _ Edu4Sure Training.pptx
Structured Query Language (SQL) _ Edu4Sure Training.pptx
 
Field datatypes
Field datatypesField datatypes
Field datatypes
 
Data type
Data typeData type
Data type
 
2017 biological databasespart2
2017 biological databasespart22017 biological databasespart2
2017 biological databasespart2
 
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfSimple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
 
Mangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.pptMangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.ppt
 
Ms access
Ms accessMs access
Ms access
 
Data types03
Data types03Data types03
Data types03
 
ADBMS Unit-II b
ADBMS Unit-II bADBMS Unit-II b
ADBMS Unit-II b
 
DBMS Relational Data Model .pptx
DBMS Relational Data Model .pptxDBMS Relational Data Model .pptx
DBMS Relational Data Model .pptx
 
Sql and mysql database concepts
Sql and mysql database conceptsSql and mysql database concepts
Sql and mysql database concepts
 

More from Eduonix Learning Solutions

More from Eduonix Learning Solutions (9)

Learn angularjs step by step
Learn angularjs step by stepLearn angularjs step by step
Learn angularjs step by step
 
Learn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design processLearn Database Design with MySQL - Chapter 6 - Database design process
Learn Database Design with MySQL - Chapter 6 - Database design process
 
Learn Database Design with MySQL - Chapter 2 - My sql overview
Learn Database Design with MySQL - Chapter 2 - My sql overviewLearn Database Design with MySQL - Chapter 2 - My sql overview
Learn Database Design with MySQL - Chapter 2 - My sql overview
 
Learn Database Design with MySQL - Chapter 1 - What is a database
Learn Database Design with MySQL - Chapter 1 -   What is a databaseLearn Database Design with MySQL - Chapter 1 -   What is a database
Learn Database Design with MySQL - Chapter 1 - What is a database
 
Ultimate android app development course
Ultimate android app development course Ultimate android app development course
Ultimate android app development course
 
Learn software development
Learn software developmentLearn software development
Learn software development
 
Learn node.js by building projects
Learn node.js by building projectsLearn node.js by building projects
Learn node.js by building projects
 
Learn hadoop and big data technologies
Learn hadoop and big data technologiesLearn hadoop and big data technologies
Learn hadoop and big data technologies
 
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
 

Recently uploaded

MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
nhezmainit1
 

Recently uploaded (20)

Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Pharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdfPharmaceutical Biotechnology VI semester.pdf
Pharmaceutical Biotechnology VI semester.pdf
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
PS-Policies-on-Enrolment-Transfer-of-Docs-Checking-of-School-Forms-and-SF10-a...
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptxMichaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
Michaelis Menten Equation and Estimation Of Vmax and Tmax.pptx
 

Learn Database Design with MySQL - Chapter 4 - Data types

  • 2. 3 CATEGORIES MySQL offers many data types but places those data types into 3 categories 1. Numeric Data Types 2. String Data Types 3. Date and Time Data Types
  • 3. SIGNED VS. UNSIGNED • An Unsigned data type can not be negative but has twice as large a range than positive integers • A Signed data type can have negative values • The types TINYINT, SMALLINT, MEDIUMINT, INT and BIGINT all have signed and unsigned versions. Type Storage Min Max INT 4 -2147483648 2147483647 INT UNSIGNED 4 0 4294967295
  • 4. NUMERIC DATA TYPES • INT – Normal sized integer. Width up to 11 digits • TINYINT – Very small integer. 0 – 255 and a width up to 4 digits. Synonym for BOOLEAN • SMALLINT – Width of 5 digits • MEDIUMINT – Width of 9 digits • BIGINT – Up to 20 digits FLOAT – Floating point number. Can define length and number of decimals DOUBLE – Double precision floating point number DECIMAL – Unpacked floating point number
  • 5. STRING DATA TYPES • CHAR – A fixed length string 1-255 chars in length. Not required to specify a length, defaults to 1 • VARCHAR – Variable-length between 1-255 chars. Must have a defined length • BLOB or TEXT – Max length of 65535 characters. BLOBs can store large binary data like images, but I would suggest NOT storing images in a database • TINYBLOB OR TINYTEXT – Max length of 255 • MEDIUMBLOB or MEDIUMTEXT – Max length of 16777215 • LONGBLOB or LONGTEXT – Max length up to 4294967295 • ENUM – An enumeration which is basically a list. Use to create a list of items for which a value must be selected.
  • 6. DATE AND TIME TYPES • DATE – A date value in YYYY-MM-DD format. September 10th, 1981 would be stored as 1981-09- 10 • DATETIME - A date and time combination in YYYY- MM-DD HH:MM:SS format, • TIMESTAMP - A timestamp between midnight, January 1, 1970 and sometime in 2037. This looks like the previous DATETIME format, only without the hyphens . • TIME -Stores the time in HH:MM:SS format • YEAR -Stores a year in 2-digit or 4-digit format.