SlideShare a Scribd company logo
1 of 4
Field Data Types
Once you have identified the tables and the fields for your database, the next step is to determine
each fields data type. With any relational database management system, you need to define what
kind of information each field will contain. In most relational database management systems,
there are three primary categories of field types:
    1. Text
    2. Numbers
    3. Dates and Times

Within each of these primary categories, there are variations of these categories, some of which
may be specific to individual RDMSs. I will highlight particular differences as they arise.

It is important to give careful thought and consideration to field types because they dictate what
information can be stored and how it is stored which may affect database performance.

MySQL Data Types

Below is a list of data types for MySQL (adapted from Ullman L. MySQL. A visual quickstart
guide. Peachpit Press: Berkeley. 2003.):

Note: The square brackets [] indicate an optional parameter to be put in parentheses, while
parentheses () indicate required arguments.


Type                           Size                           Description
CHAR[Length]                   Length bytes                   A fixed-length field from 0 to 255
                                                              characters long.
VARCHAR(Length)                String length + 1 bytes        A fixed-length field from 0 to 255
                                                              characters long.
TINYTEXT                       String length + 1 bytes        A string with a maximum length of
                                                              255 characters
TEXT                           String length + 2 bytes        A string with a maximum length of
                                                              65,535 characters.
MEDIUMTEXT                     String length + 3 bytes        A string with a maximum length of
                                                              16,777,215 characters.
LONGTEXT                       String length + 4 bytes        A string with a maximum length of
                                                              4,294,967,295 characters.
TINYINT[Length]                1 byte                         Range of -128 to 127 or 0 to 255
                                                              unsigned.
SMALLINT[Length]               2 bytes                        Range of -32,768 to 32,767 or 0 to
                                                              65,535 unsigned.
MEDIUMINT[Length]              3 bytes                        Range of -8,388,608 to 8,388,607 or 0
                                                              to 16,777,215 unsigned



                                                 1
INT[Length]                       4 bytes                    Range of -2,147,483,648 to
                                                             2,147,483,647 or 0 to 4,294,967,295
                                                             unsigned
BIGINT[Length]                    8 bytes                    Range of -9,223,372,036,854,775,808
                                                             to 9,223,372,036,854,775,807 or 0 to
                                                             18,446,744,073,709,551,615 unsigned
FLOAT                             4 bytes                    A small number with a floating
                                                             decimal point.
DOUBLE[Length, Decimals]          8 bytes                    A large number with a floating
                                                             decimal point.
DECIMAL[Length, Decimals]         Length +1 bytes or         A DOUBLE stored as a string,
                                  Length + 2 bytes           allowing for a fixed decimal point.
DATE                              3 bytes                    In the format YYYY-MM-DD
DATETIME                          8 bytes                    In the format YYYY-MM-DD
                                                             HH:MM:SS.
TIMESTAMP                         4 bytes                    In the format
                                                             YYYYMMDDHHMMSS; acceptable
                                                             range ends in the year 2037.
TIME                              3 bytes                    In the format of HH:MM:SS.
ENUM                              1 or 2 bytes               Short for enumeration, that is, each
                                                             column can have one of several
                                                             possible values.
SET                               1, 2, 3, 4, or 8 bytes     Like ENUM except that each column
                                                             can have more than one of several
                                                             possible values.


Microsoft Access Data Types

Below is a list of data types for Microsoft Access (adapted from Schwartz S. Microsoft Office
Access 2003. A visual quickstart guide. Peachpit Press: Berkeley 2004).

In Microsoft Access, each field can be one of the following data types:

   1. Text: a Text field can store any combination of typed characters: letters, numbers, and
      punctuation.
   2. Memo: a Memo field is an extra large Text field (up to 65,535 characters). When
      sorting on a Memo field, Access only considers the first 255 characters.
   3. Number: a Number field is used to store most types of numeric data (with the exception
      of monetary amounts which can be stored using the Currency field type).
   4. Currency: this data type has been designed specifically to store currency amounts and
      prevent rounding errors.
   5. Auto Number: the Auto Number data type is used to automatically assign a new number
      to a primary key field, increasing the previously assigned number by one. Data stored in
      an Auto Number field cannot be edited.


                                                 2
6. Date/Time: a Date/Time field is used to store dates or times. A specific format to
       display dates and times can be selected.
   7. Yes/No: a Yes/No field is the Access data type for recording one of two opposing
       values. Yes/No fields can be formatted as Yes/No, True/False, or On/Off (although all
       are equivalent). Every Yes/No field is formatted as a single check box; checked is “Yes”,
       “True”, or “On” whereas unchecked is “No”, “False”, or “Off”.
   8. OLE Object: Object Linking and Embedding (OLE) Object data types enable you to
       embed or link to documents created in other programs, such as worksheets created in MS
       Excel, images (eg, gif, or jpg files), or word processing files (eg, doc files); one can either
       embed the object in the Access data file or link the object to the database, thereby storing
       a pointer or a reference to the original document. OLE is the technology which allows an
       object (such as a spreadsheet) to be embedded (and/or linked) inside of another document
       (like a word processor document).
   9. Hyperlink: the Hyperlink data type enables you to store a “clickable” address in the
       field. For example:
           a. http://
           b. mailto:
           c. ftp://
   10. Lookup Wizard: a Lookup Wizard field type enables a field to display a drop-down list
       of values from which the user can choose; this list of values can come from another
       table, a query, or event he same table.

A Review of Bits and Bytes
(This section has been adapted from Marshall Brain’s article on “How Bits and Bytes Work”
from http://www.howstuffworks.com.)

In order to understand a little about field types and their bytes, it’s important to review briefly
what bytes (and bits) are.

Let’s first review the concept of decimal numbers. I think everyone is familiar with decimal
places and digits of a decimal number. Each digit can range from 0 to 9, that is, ten possible
values. For example, we know that the number 1,488 has four digits with four decimal places: 8
ones, 8 tens, 4 hundreds, and 1 thousands. So the number 1,488 could be expressed as:

       (1*1000) + (4*100) + (8*10) + (8*1) = 1000 + 400 + 80 + 8 = 1,488

Similarly, we could express the same number in terms of powers of 10:

       (1*10^3) + (4*10^2) + (8*10^1) + (8*10^0) = 1000 + 400 + 80 + 8 = 1,488

Recall, anything to the zero power is equal to 1.

Bits and bytes could be viewed in a similar way. Computers use the base-2 system known as the
binary number system just as the base-10 number system is known as the decimal number
system. Each binary digit (also called a “bit” for Binary digIT) can only take on one of two


                                                    3
values, 1 or 0, instead of 0 to 9 like the decimal system. So the binary number 1100 would
represent:

       (1*2^3) + (1*2^2) + (0*2^1) + (0*2^0) = 12

This time we use base of 2 instead of base of 10.

A collection of 8 bits is known as one byte. With 8 bits in a byte, one can represent 256 values
ranging from 0 to 255:


       00000000 = (0*2^7) + (0*2^6) + (0*2^5) + (0*2^4) + (0*2^3) + (0*2^2) +
                   (0*2^1) + (0*2^0)
                =0

       11111111 = (1*2^7) + (1*2^6) + (1*2^5) + (1*2^4) + (1*2^3) + (1*2^2) +
                  (1*2^1) + (1*2^0)
                = 255

Three bytes (24 bits) can then represent a number ranging from 0 to 16,777,215.

       000000000000000000000000 = (0*2^23) + (0*2^22) + (0*2^21) + …+ (0*2^4) +
                                  (0*2^3) + (0*2^2) + (0*2^1) + (0*2^0)
                                =0

       111111111111111111111111 = (1*2^23) + (1*2^22) + (1*2^21) + …+ (1*2^4) +
                                  (1*2^3) + (1*2^2) + (1*2^1) + (1*2^0)
                                = 16,777,215


Bytes are used to hold individual characters in a text document. For example, 00100000 is equal
to 32 which is the numeric code for “space”. So text characters are coded as numbers which are
stored as bytes in a computer file. The computer usually stores each character in 1 byte.




                                                4

More Related Content

Viewers also liked

RNchat Transcript February, 12 2010
RNchat Transcript February, 12 2010RNchat Transcript February, 12 2010
RNchat Transcript February, 12 2010RN Chat
 
Recruit dc agenda final
Recruit dc agenda finalRecruit dc agenda final
Recruit dc agenda finalRecruitDC
 
Taddy Porter Copones Flyer
Taddy Porter Copones FlyerTaddy Porter Copones Flyer
Taddy Porter Copones FlyerPhillip0582
 
Business Wales - procurement mini-conference 2014
Business Wales - procurement mini-conference 2014Business Wales - procurement mini-conference 2014
Business Wales - procurement mini-conference 2014walescva
 
05 SSIS Control Flow
05 SSIS Control Flow05 SSIS Control Flow
05 SSIS Control FlowSlava Kokaev
 
Applicant Fracking Systems
Applicant Fracking SystemsApplicant Fracking Systems
Applicant Fracking SystemsRecruitDC
 

Viewers also liked (7)

RNchat Transcript February, 12 2010
RNchat Transcript February, 12 2010RNchat Transcript February, 12 2010
RNchat Transcript February, 12 2010
 
Room 15 building projects
Room 15 building projectsRoom 15 building projects
Room 15 building projects
 
Recruit dc agenda final
Recruit dc agenda finalRecruit dc agenda final
Recruit dc agenda final
 
Taddy Porter Copones Flyer
Taddy Porter Copones FlyerTaddy Porter Copones Flyer
Taddy Porter Copones Flyer
 
Business Wales - procurement mini-conference 2014
Business Wales - procurement mini-conference 2014Business Wales - procurement mini-conference 2014
Business Wales - procurement mini-conference 2014
 
05 SSIS Control Flow
05 SSIS Control Flow05 SSIS Control Flow
05 SSIS Control Flow
 
Applicant Fracking Systems
Applicant Fracking SystemsApplicant Fracking Systems
Applicant Fracking Systems
 

Similar to Field datatypes

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 veligetiNaveen Kumar Veligeti
 
Tugas basis data 2012110028
Tugas basis data 2012110028Tugas basis data 2012110028
Tugas basis data 2012110028UIGM
 
Learning VB.NET Programming Concepts
Learning VB.NET Programming ConceptsLearning VB.NET Programming Concepts
Learning VB.NET Programming Conceptsguest25d6e3
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)Edu4Sure
 
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfSimple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfManojVishwakarma91
 
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_uploadProf. Wim Van Criekinge
 
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.pptxEdu4Sure
 
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_uploadProf. Wim Van Criekinge
 
Visual basic intoduction
Visual basic intoductionVisual basic intoduction
Visual basic intoductionSpy Seat
 
Intro To TSQL - Unit 5
Intro To TSQL - Unit 5Intro To TSQL - Unit 5
Intro To TSQL - Unit 5iccma
 

Similar to Field datatypes (20)

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
 
Tugas basis data 2012110028
Tugas basis data 2012110028Tugas basis data 2012110028
Tugas basis data 2012110028
 
Data types
Data typesData types
Data types
 
MySQL Data types
MySQL Data typesMySQL Data types
MySQL Data types
 
2016 02 23_biological_databases_part2
2016 02 23_biological_databases_part22016 02 23_biological_databases_part2
2016 02 23_biological_databases_part2
 
Learning VB.NET Programming Concepts
Learning VB.NET Programming ConceptsLearning VB.NET Programming Concepts
Learning VB.NET Programming Concepts
 
SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)SQL (Basic to Intermediate Customized 8 Hours)
SQL (Basic to Intermediate Customized 8 Hours)
 
Database Sizing
Database SizingDatabase Sizing
Database Sizing
 
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdfSimple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
Simple Queriebhjjnhhbbbbnnnnjjs In SQL.pdf
 
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
MySqlMySql
MySql
 
2017 biological databasespart2
2017 biological databasespart22017 biological databasespart2
2017 biological databasespart2
 
Sql Basics And Advanced
Sql Basics And AdvancedSql Basics And Advanced
Sql Basics And Advanced
 
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
 
DBMS
DBMSDBMS
DBMS
 
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
 
Datatypes
DatatypesDatatypes
Datatypes
 
Visual basic intoduction
Visual basic intoductionVisual basic intoduction
Visual basic intoduction
 
Mysql datatypes
Mysql datatypesMysql datatypes
Mysql datatypes
 
Intro To TSQL - Unit 5
Intro To TSQL - Unit 5Intro To TSQL - Unit 5
Intro To TSQL - Unit 5
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 

Field datatypes

  • 1. Field Data Types Once you have identified the tables and the fields for your database, the next step is to determine each fields data type. With any relational database management system, you need to define what kind of information each field will contain. In most relational database management systems, there are three primary categories of field types: 1. Text 2. Numbers 3. Dates and Times Within each of these primary categories, there are variations of these categories, some of which may be specific to individual RDMSs. I will highlight particular differences as they arise. It is important to give careful thought and consideration to field types because they dictate what information can be stored and how it is stored which may affect database performance. MySQL Data Types Below is a list of data types for MySQL (adapted from Ullman L. MySQL. A visual quickstart guide. Peachpit Press: Berkeley. 2003.): Note: The square brackets [] indicate an optional parameter to be put in parentheses, while parentheses () indicate required arguments. Type Size Description CHAR[Length] Length bytes A fixed-length field from 0 to 255 characters long. VARCHAR(Length) String length + 1 bytes A fixed-length field from 0 to 255 characters long. TINYTEXT String length + 1 bytes A string with a maximum length of 255 characters TEXT String length + 2 bytes A string with a maximum length of 65,535 characters. MEDIUMTEXT String length + 3 bytes A string with a maximum length of 16,777,215 characters. LONGTEXT String length + 4 bytes A string with a maximum length of 4,294,967,295 characters. TINYINT[Length] 1 byte Range of -128 to 127 or 0 to 255 unsigned. SMALLINT[Length] 2 bytes Range of -32,768 to 32,767 or 0 to 65,535 unsigned. MEDIUMINT[Length] 3 bytes Range of -8,388,608 to 8,388,607 or 0 to 16,777,215 unsigned 1
  • 2. INT[Length] 4 bytes Range of -2,147,483,648 to 2,147,483,647 or 0 to 4,294,967,295 unsigned BIGINT[Length] 8 bytes Range of -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 or 0 to 18,446,744,073,709,551,615 unsigned FLOAT 4 bytes A small number with a floating decimal point. DOUBLE[Length, Decimals] 8 bytes A large number with a floating decimal point. DECIMAL[Length, Decimals] Length +1 bytes or A DOUBLE stored as a string, Length + 2 bytes allowing for a fixed decimal point. DATE 3 bytes In the format YYYY-MM-DD DATETIME 8 bytes In the format YYYY-MM-DD HH:MM:SS. TIMESTAMP 4 bytes In the format YYYYMMDDHHMMSS; acceptable range ends in the year 2037. TIME 3 bytes In the format of HH:MM:SS. ENUM 1 or 2 bytes Short for enumeration, that is, each column can have one of several possible values. SET 1, 2, 3, 4, or 8 bytes Like ENUM except that each column can have more than one of several possible values. Microsoft Access Data Types Below is a list of data types for Microsoft Access (adapted from Schwartz S. Microsoft Office Access 2003. A visual quickstart guide. Peachpit Press: Berkeley 2004). In Microsoft Access, each field can be one of the following data types: 1. Text: a Text field can store any combination of typed characters: letters, numbers, and punctuation. 2. Memo: a Memo field is an extra large Text field (up to 65,535 characters). When sorting on a Memo field, Access only considers the first 255 characters. 3. Number: a Number field is used to store most types of numeric data (with the exception of monetary amounts which can be stored using the Currency field type). 4. Currency: this data type has been designed specifically to store currency amounts and prevent rounding errors. 5. Auto Number: the Auto Number data type is used to automatically assign a new number to a primary key field, increasing the previously assigned number by one. Data stored in an Auto Number field cannot be edited. 2
  • 3. 6. Date/Time: a Date/Time field is used to store dates or times. A specific format to display dates and times can be selected. 7. Yes/No: a Yes/No field is the Access data type for recording one of two opposing values. Yes/No fields can be formatted as Yes/No, True/False, or On/Off (although all are equivalent). Every Yes/No field is formatted as a single check box; checked is “Yes”, “True”, or “On” whereas unchecked is “No”, “False”, or “Off”. 8. OLE Object: Object Linking and Embedding (OLE) Object data types enable you to embed or link to documents created in other programs, such as worksheets created in MS Excel, images (eg, gif, or jpg files), or word processing files (eg, doc files); one can either embed the object in the Access data file or link the object to the database, thereby storing a pointer or a reference to the original document. OLE is the technology which allows an object (such as a spreadsheet) to be embedded (and/or linked) inside of another document (like a word processor document). 9. Hyperlink: the Hyperlink data type enables you to store a “clickable” address in the field. For example: a. http:// b. mailto: c. ftp:// 10. Lookup Wizard: a Lookup Wizard field type enables a field to display a drop-down list of values from which the user can choose; this list of values can come from another table, a query, or event he same table. A Review of Bits and Bytes (This section has been adapted from Marshall Brain’s article on “How Bits and Bytes Work” from http://www.howstuffworks.com.) In order to understand a little about field types and their bytes, it’s important to review briefly what bytes (and bits) are. Let’s first review the concept of decimal numbers. I think everyone is familiar with decimal places and digits of a decimal number. Each digit can range from 0 to 9, that is, ten possible values. For example, we know that the number 1,488 has four digits with four decimal places: 8 ones, 8 tens, 4 hundreds, and 1 thousands. So the number 1,488 could be expressed as: (1*1000) + (4*100) + (8*10) + (8*1) = 1000 + 400 + 80 + 8 = 1,488 Similarly, we could express the same number in terms of powers of 10: (1*10^3) + (4*10^2) + (8*10^1) + (8*10^0) = 1000 + 400 + 80 + 8 = 1,488 Recall, anything to the zero power is equal to 1. Bits and bytes could be viewed in a similar way. Computers use the base-2 system known as the binary number system just as the base-10 number system is known as the decimal number system. Each binary digit (also called a “bit” for Binary digIT) can only take on one of two 3
  • 4. values, 1 or 0, instead of 0 to 9 like the decimal system. So the binary number 1100 would represent: (1*2^3) + (1*2^2) + (0*2^1) + (0*2^0) = 12 This time we use base of 2 instead of base of 10. A collection of 8 bits is known as one byte. With 8 bits in a byte, one can represent 256 values ranging from 0 to 255: 00000000 = (0*2^7) + (0*2^6) + (0*2^5) + (0*2^4) + (0*2^3) + (0*2^2) + (0*2^1) + (0*2^0) =0 11111111 = (1*2^7) + (1*2^6) + (1*2^5) + (1*2^4) + (1*2^3) + (1*2^2) + (1*2^1) + (1*2^0) = 255 Three bytes (24 bits) can then represent a number ranging from 0 to 16,777,215. 000000000000000000000000 = (0*2^23) + (0*2^22) + (0*2^21) + …+ (0*2^4) + (0*2^3) + (0*2^2) + (0*2^1) + (0*2^0) =0 111111111111111111111111 = (1*2^23) + (1*2^22) + (1*2^21) + …+ (1*2^4) + (1*2^3) + (1*2^2) + (1*2^1) + (1*2^0) = 16,777,215 Bytes are used to hold individual characters in a text document. For example, 00100000 is equal to 32 which is the numeric code for “space”. So text characters are coded as numbers which are stored as bytes in a computer file. The computer usually stores each character in 1 byte. 4