際際滷

際際滷Share a Scribd company logo
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.
THATS IT!

More Related Content

Viewers also liked (12)

Expand Your Loft Space
Expand Your Loft Space Expand Your Loft Space
Expand Your Loft Space
Melton Design Build
Conalep tlalnepantla 1
Conalep tlalnepantla      1Conalep tlalnepantla      1
Conalep tlalnepantla 1
abbigali
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
Eduonix Learning Solutions
Int to tourism and hospitality(1)
Int to tourism and hospitality(1)Int to tourism and hospitality(1)
Int to tourism and hospitality(1)
Sangeetha Rajagurusamy
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
Make an Entrance
Make an EntranceMake an Entrance
Make an Entrance
Melton Design Build
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...
ZELA_infor
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
Jen Vuhuong
Acitividad no.4Acitividad no.4
Acitividad no.4
Henry Reyes
Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01
frans2014
舒亰 亢舒亞舒仍舒亶 勵仍亞
舒亰 亢舒亞舒仍舒亶 勵仍亞舒亰 亢舒亞舒仍舒亶 勵仍亞
舒亰 亢舒亞舒仍舒亶 勵仍亞
Nyamzaya Gerelzaya
Pictures of earth
Pictures of earthPictures of earth
Pictures of earth
vikas thakur
Conalep tlalnepantla 1
Conalep tlalnepantla      1Conalep tlalnepantla      1
Conalep tlalnepantla 1
abbigali
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
Eduonix Learning Solutions
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
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...
ZELA_infor
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
Jen Vuhuong
Acitividad no.4Acitividad no.4
Acitividad no.4
Henry Reyes
Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01Mekanikateknik 140330175907-phpapp01
Mekanikateknik 140330175907-phpapp01
frans2014
舒亰 亢舒亞舒仍舒亶 勵仍亞
舒亰 亢舒亞舒仍舒亶 勵仍亞舒亰 亢舒亞舒仍舒亶 勵仍亞
舒亰 亢舒亞舒仍舒亶 勵仍亞
Nyamzaya Gerelzaya
Pictures of earth
Pictures of earthPictures of earth
Pictures of earth
vikas thakur

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

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
Prof. Wim Van Criekinge
MySql
MySqlMySql
MySql
Sukrit Gupta
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
Prof. Wim Van Criekinge
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
Kaveen Prathibha Kumarasinghe
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
PPT CREATEIVEhahhahahahhahahahahahaha.pptxPPT CREATEIVEhahhahahahhahahahahahaha.pptx
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
DjTayone
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
MLG College of Learning, Inc
Mysql datatypes
Mysql datatypesMysql datatypes
Mysql datatypes
V.V.Vanniaperumal College for Women
2016 02 23_biological_databases_part2
2016 02 23_biological_databases_part22016 02 23_biological_databases_part2
2016 02 23_biological_databases_part2
Prof. Wim Van Criekinge
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
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
Edu4Sure
Field datatypes
Field datatypesField datatypes
Field datatypes
hanuman
Data type
Data typeData type
Data type
Frijo Francis
2017 biological databasespart2
2017 biological databasespart22017 biological databasespart2
2017 biological databasespart2
Prof. Wim Van Criekinge
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfSimple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
ManojVishwakarma91
Mangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.pptMangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.ppt
Mihir Shah
mysql datatype______________________.docx
mysql datatype______________________.docxmysql datatype______________________.docx
mysql datatype______________________.docx
Ajanya5
Introduction to Data Analysis Using Spread sheet
Introduction to Data Analysis Using Spread sheetIntroduction to Data Analysis Using Spread sheet
Introduction to Data Analysis Using Spread sheet
bandanadiiMahapatra
normalaization in databse management systems
normalaization in databse management systemsnormalaization in databse management systems
normalaization in databse management systems
pmselvaraj
Ms access
Ms accessMs access
Ms access
yousufvali
Data types03
Data types03Data types03
Data types03
Sriniti Jessica
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
Prof. Wim Van Criekinge
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
Prof. Wim Van Criekinge
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
PPT CREATEIVEhahhahahahhahahahahahaha.pptxPPT CREATEIVEhahhahahahhahahahahahaha.pptx
PPT CREATEIVEhahhahahahhahahahahahaha.pptx
DjTayone
2016 02 23_biological_databases_part2
2016 02 23_biological_databases_part22016 02 23_biological_databases_part2
2016 02 23_biological_databases_part2
Prof. Wim Van Criekinge
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
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
Edu4Sure
Field datatypes
Field datatypesField datatypes
Field datatypes
hanuman
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfSimple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
ManojVishwakarma91
Mangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.pptMangala Deshpande MySQL0710.ppt
Mangala Deshpande MySQL0710.ppt
Mihir Shah
mysql datatype______________________.docx
mysql datatype______________________.docxmysql datatype______________________.docx
mysql datatype______________________.docx
Ajanya5
Introduction to Data Analysis Using Spread sheet
Introduction to Data Analysis Using Spread sheetIntroduction to Data Analysis Using Spread sheet
Introduction to Data Analysis Using Spread sheet
bandanadiiMahapatra
normalaization in databse management systems
normalaization in databse management systemsnormalaization in databse management systems
normalaization in databse management systems
pmselvaraj

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
Eduonix Learning Solutions
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
Eduonix Learning Solutions
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
Eduonix Learning Solutions
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
Eduonix Learning Solutions
Ultimate android app development course
Ultimate android app development course Ultimate android app development course
Ultimate android app development course
Eduonix Learning Solutions
Learn software development
Learn software developmentLearn software development
Learn software development
Eduonix Learning Solutions
Learn node.js by building projects
Learn node.js by building projectsLearn node.js by building projects
Learn node.js by building projects
Eduonix Learning Solutions
Learn hadoop and big data technologies
Learn hadoop and big data technologiesLearn hadoop and big data technologies
Learn hadoop and big data technologies
Eduonix Learning Solutions
Java programming course for beginners
Java programming course for beginnersJava programming course for beginners
Java programming course for beginners
Eduonix Learning Solutions
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
Eduonix Learning Solutions
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
Eduonix Learning Solutions
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
Eduonix Learning Solutions

Recently uploaded (20)

N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
DBMS Interview Questions PDF By ScholarHat
DBMS Interview Questions PDF By ScholarHatDBMS Interview Questions PDF By ScholarHat
DBMS Interview Questions PDF By ScholarHat
Scholarhat
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
Admission Procedure and types in hospital pptx
Admission Procedure  and types in hospital pptxAdmission Procedure  and types in hospital pptx
Admission Procedure and types in hospital pptx
PoojaSen20
Azure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHatAzure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHat
Scholarhat
How to create security group category in Odoo 17
How to create security group category in Odoo 17How to create security group category in Odoo 17
How to create security group category in Odoo 17
Celine George
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptxGRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
AngellieMaeDoce
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptxCyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
KelishaCyrus
Azure Solution Architect Interview Questions By ScholarHat
Azure Solution Architect Interview Questions By ScholarHatAzure Solution Architect Interview Questions By ScholarHat
Azure Solution Architect Interview Questions By ScholarHat
Scholarhat
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptxFinal-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
jennifersayong3
Rest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHatRest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHat
Scholarhat
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
ITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free DownloadITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free Download
SONU HEETSON
HTML Interview Questions PDF By ScholarHat
HTML Interview Questions PDF By ScholarHatHTML Interview Questions PDF By ScholarHat
HTML Interview Questions PDF By ScholarHat
Scholarhat
The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .
saanidhyapatel09
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdfNUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
Dolisha Warbi
N.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity BriefingN.C. DPI's 2023 Language Diversity Briefing
N.C. DPI's 2023 Language Diversity Briefing
Mebane Rash
OOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHatOOPs Interview Questions PDF By ScholarHat
OOPs Interview Questions PDF By ScholarHat
Scholarhat
Digital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptxDigital Tools with AI for e-Content Development.pptx
Digital Tools with AI for e-Content Development.pptx
Dr. Sarita Anand
DBMS Interview Questions PDF By ScholarHat
DBMS Interview Questions PDF By ScholarHatDBMS Interview Questions PDF By ScholarHat
DBMS Interview Questions PDF By ScholarHat
Scholarhat
Year 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptxYear 10 The Senior Phase Session 3 Term 1.pptx
Year 10 The Senior Phase Session 3 Term 1.pptx
mansk2
Admission Procedure and types in hospital pptx
Admission Procedure  and types in hospital pptxAdmission Procedure  and types in hospital pptx
Admission Procedure and types in hospital pptx
PoojaSen20
Azure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHatAzure Administrator Interview Questions By ScholarHat
Azure Administrator Interview Questions By ScholarHat
Scholarhat
How to create security group category in Odoo 17
How to create security group category in Odoo 17How to create security group category in Odoo 17
How to create security group category in Odoo 17
Celine George
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptxGRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
GRADE-1-QUARTER 4-MATHEMATICS-WEEK-3.pptx
AngellieMaeDoce
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptxCyrus_Kelisha_SMM_PB1_2024-November.pptx
Cyrus_Kelisha_SMM_PB1_2024-November.pptx
KelishaCyrus
Azure Solution Architect Interview Questions By ScholarHat
Azure Solution Architect Interview Questions By ScholarHatAzure Solution Architect Interview Questions By ScholarHat
Azure Solution Architect Interview Questions By ScholarHat
Scholarhat
Research & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptxResearch & Research Methods: Basic Concepts and Types.pptx
Research & Research Methods: Basic Concepts and Types.pptx
Dr. Sarita Anand
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdfBlind spots in AI and Formulation Science, IFPAC 2025.pdf
Blind spots in AI and Formulation Science, IFPAC 2025.pdf
Ajaz Hussain
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptxFinal-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
Final-PPT-on-Reading-Comprehension-in-the-Early-Years.pptx
jennifersayong3
Rest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHatRest API Interview Questions PDF By ScholarHat
Rest API Interview Questions PDF By ScholarHat
Scholarhat
How to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 EmployeeHow to Configure Flexible Working Schedule in Odoo 18 Employee
How to Configure Flexible Working Schedule in Odoo 18 Employee
Celine George
ITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free DownloadITI Turner Question Paper MCQ E-Book Free Download
ITI Turner Question Paper MCQ E-Book Free Download
SONU HEETSON
HTML Interview Questions PDF By ScholarHat
HTML Interview Questions PDF By ScholarHatHTML Interview Questions PDF By ScholarHat
HTML Interview Questions PDF By ScholarHat
Scholarhat
The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .The Constitution, Government and Law making bodies .
The Constitution, Government and Law making bodies .
saanidhyapatel09
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdfNUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
NUTRITIONAL ASSESSMENT AND EDUCATION - 5TH SEM.pdf
Dolisha Warbi

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.