EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

MariaDB Data Types

Home » Data Science » Data Science Tutorials » Database Management Tutorial » MariaDB Data Types

MariaDB Data Types

Introduction to MariaDB Data Types

It is necessary that the database that you are designing should be optimized and efficient. For creating a perfect database, the tables and the structure that is defined should be normalized and most importantly the fields of the tables that are columns should have the proper data type. The data type of the field should be defined in such a manner that it should be able to carry the values that are necessary. For this, the type of the value and the length of the field should be chosen properly. The datatypes in Maria DB are broadly classified into three different types numeric, date and time, and string values.

In this article, we will study different types of numeric, date and time and string related data types, their capacity, and the maximum capacity that the field can have when assigned that particular data type and when we can use those data types depending on the requirement. When we design the fields and give them the appropriate size and type of data type, our database will be optimized.

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Types of MariaDB Data Types

Let us discuss types of MariaDB Data Types.

Numeric Datatypes

In MariaDB we have the following data types of numeric type that are supported –

  • TINYINT– We can store small integer values in this type of data type. The range of the tiny int data type is -128 to 127 for the signed tiny int datatype and 0 to 255 for an unsigned datatype.
  • BOOLEAN– We can store a value that can have any one of the two values in this datatype of values where 0 corresponds to false while 1 corresponds to true.
  • SMALLINT− We can store small integer values in this type of data type. The range of the small int data type is -32768 to 32768 for the signed small int datatype and 0 to 65535 for an unsigned datatype.
  • MEDIUMINT− We can store integer values in this type of data type where a range of the data type is -8388608 to 8388607 for the signed datatype and 0 to 16777215 for unsigned datatype.
  • INT(also INTEGER)− We can store normal integer values in this type of data type. The range of the int data type is -2147483648 to 2147483647 for the signed int datatype and 0 to 4294967295 for the unsigned datatype.
  • BIGINT− We can store big integer values in this type of data type. The range of the int data type is -9223372036854775808 to 9223372036854775807 for the signed int datatype and 0 to 18446744073709551615 for the unsigned datatype.
  • DECIMAL – This type of datatype helps us to store the fixed-point numbers of precision which is also called NUMERIC, DEC, or FIXED. The M stands for the number of the digits that are allowed in the number while D helps to specify the number of places allowed after the decimal point. The default values of M will be 10 while that of D is kept as 0 when not specified or ommitted. The maximum permissible values for M and D are 65 digits before the decimal point and 30 places after the decimal point.
  • FLOAT− We can store small floating-point values in this type of data type where allowed values of the data type are 0,-3.402823466E+38 to -1.175494351E-38, and 1.175494351E-38 to 3.402823466E+38.
  • DOUBLE– This type of datatype helps us to store the fixed-point numbers of precision which is also called as REAL and DOUBLE PRECISION. Allowed values of the data type are 0, -1.7976931348623157E+308 to -2.2250738585072014E-308 or 2.2250738585072014E-308 to 1.7976931348623157E+308
  • BIT– We can store bit values in this type of datatypes. The M that is given while specifying the BIT datatype stands for the number of bit fields. The default value of M for BIT data type is 1. The values of this data type are represented in the format b’[value]’” where values are presented in the format of 0s and 1s. When used for a full length, there is automatically zero-padding being made from the left side. For example when we specify 101 then it automatically converts to 0101.

Date and Time Data Types

In MariaDB we have the following data types of Date and Time type that are supported –

  • DATE– The format supported by this data type is “YYYY-MM-DD”  and the range of the values supported by this datatype “1000-01-01” to “9999-12-31.
  • TIME− The range of the values supported by this datatype “-838:59:59.999999” to “838:59:59.999999.” and is used for storing the time.
  • DATETIME− The format supported by this data type is “YYYY-MM-DD HH:MM:SS” and the range of the values supported by this datatype “1000-01-01 00:00:00.000000” to “9999-12-31 23:59:59.999999.”
  • TIMESTAMPThe format supported by this data type is “YYYY-MM-DD HH:MM:SS” and is mainly used to keep the time details for all the modifications made to the database which includes the insertion and updation of the values of the database.
  • YEAR− The format supported by this data type is “YYYY” and the range of the values supported by this datatype 0000 and 1901 to 2155.

String DataTypes

In MariaDB, we have the following data types of String type that are supported –

  • String literals– We can store the sequence of characters closed between the two double quotes in this type of value.
  • CHAR− The string values stored in this type of datatype includes spaces in it and are of fixed length and usually right padded. The length of the column characters is represented by the M whose range is between 0 to 255. When not specified the default value of M is 1.
  • VARCHAR– We can store variable-length strings in this datatype in which the column length can have a range of values between 0 to 65535.
  • BINARY– The column length specified in M for this datatype is in bytes and this datatype is mostly used for storing the binary byte strings.
  • BLOB– The maximum length of this type of data type is 65,535 (2^16 – 1) bytes and is used to store the BLOB values.
  • TEXT− The maximum length of this type of datatype is 65,535 (2^16 – 1) bytes
  • ENUM– The datatype can be used when we want to have only a single value is stored in the column from the list of the specified values.
  • SET– We can store zero or more values from the list of the values with a maximum number of 64 members being stored at a time in the string format. However, these values are internally represented as integer values.

Conclusion

In MariaDB, we have different categories of numeric, date, and time and string-related datatypes that are being supported and have a different range, size, and purpose of use.

Recommended Articles

This is a guide to MariaDB Data Types. Here we discuss the Introduction, types of MariaDB Data Types respectively. You may also have a look at the following articles to learn more –

Popular Course in this category
Sale
SQL Training Program (7 Courses, 8+ Projects)7 Online Courses | 8 Hands-on Projects | 73+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (8,952 ratings)
Course Price

View Course

Related Courses
PL SQL Training (4 Courses, 2+ Projects)Oracle Training (14 Courses, 8+ Projects)
  1. MariaDB GROUP_CONCAT
  2. MariaDB wait_timeout
  3. MariaDB Timezone
  4. MariaDB Grant All Privileges

All in One Data Science Bundle (360+ Courses, 50+ projects)

360+ Online Courses

50+ projects

1500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Database Management Tutorial
  • MariaDB
    • MariaDB Versions
    • MariaDB?list users
    • MariaDB Commands
    • MariaDB odbc
    • MariaDB Workbench
    • MariaDB for windows
    • MariaDB Server
    • MariaDB? Data Types
    • MariaDB?boolean
    • MariaDB phpMyAdmin
    • MariaDB Mysqldump
    • MariaDB Java Connector
    • MariaDB insert
    • MariaDB UPDATE
    • MariaDB? rename column
    • MariaDB AUTO_INCREMENT
    • MariaDB Timezone
    • MariaDB GROUP_CONCAT
    • MariaDB wait_timeout
    • MariaDB MaxScale
    • MariaDB? with
    • MariaDB? create?table
    • MariaDB? SHOW TABLES
    • MariaDB alter table
    • MariaDB List Tables
    • MariaDB JSON Functions
    • MariaDB Foreign Key
    • MariaDB? trigger
    • MariaDB Grant All Privileges
    • MariaDB Select Database
    • MariaDB? create database
    • MariaDB Delete Database
    • MariaDB List Databases
    • MariaDB Functions
    • MariaDB? TIMESTAMP
    • MariaDB create user
    • MariaDB add user
    • MariaDB show users
    • MariaDB Delete User
    • MariaDB? change user password
    • MariaDB? change root password
    • MariaDB reset root password
    • MariaDB IF
    • MariaDB bind-address
    • MariaDB Transaction
    • MariaDB Cluster
    • MariaDB Logs
    • MariaDB Encryption
    • MariaDB? backup
    • MariaDB Replication
    • MariaDB max_allowed_packet
    • MariaDB? performance tuning
    • MariaDB export database
    • MariaDB? import SQL
  • DataBase Management
    • Text Data Mining
    • Roles of Database Management System in Industry
    • SQL Server Database Management Tools
    • Database administrator skills
    • Database Management Systems Advantages
    • Database Testing Interview Questions
    • Data Administrator
    • Database Administrator
    • Database Management Software
    • DataStage
    • Types of Database Models
    • Types of Database
    • Hierarchical Database Model
    • Relational Database
    • Relational Database Advantages
    • Operational Database
    • What is RDBMS?
    • What is DB2?
    • Data Masking Tools
    • Database Security
    • Data Replication
    • Bitmap Indexing
    • Second Normal Form
    • Third Normal Form
    • Fourth Normal Form
    • Data Definition Language
    • Data Manipulation Language
    • Data Control Language
    • Transaction Control Language
    • Conceptual Data Model
    • Entity-Relationship Model
    • Relational Database Model
    • Sequential File Organization
    • Checkpoint in DBMS
    • Teradata Create Table
    • Centralized Database
    • Data Storage in Database
    • Thomas write Rule
    • DBA Interview Questions
    • What is JDBC?
    • jdbc hive
    • Apriori Algorithm
    • JDBC Architecture
    • JDBC Interview Questions
    • Wildcard Characters
    • Distributed Database System
    • Multidimensional Database
  • PL/SQL
    • What is PL/SQL?
    • Careers in PL/SQL
    • PLSQL procedure
    • PL/SQL Exception
    • PL/SQL LIKE
    • PL/SQL Raise Exception
    • PLSQL rowtype
    • PLSQL? bind variables
    • PL/SQL Record
    • PL/SQL WITH
    • PL/SQL bulk collect
    • PL/SQL Block Structure
    • PL/SQL else if
    • PL/SQL nvl2
    • PL/SQL Package
    • PL/SQL exists
    • PL/SQL instr
    • PL/SQL listagg
    • PL/ SQL Formatter
    • PLSQLlength
    • PL/SQL Commands
    • PL/SQL Data Types
    • CASE statement in PL/SQL
    • PL/SQL IF Statement
    • Loops in PL/SQL
    • PL/SQL Add Column
    • For Loop in PLSQL
    • PL/SQL Cursor Loop
    • PLSQL Array
    • Cursors in PL/SQL
    • PL/SQL FOR Loop Cursor
    • PL/SQL Queries
    • PL/SQL SELECT INTO
    • PL/SQL TO_CHAR
    • PL/SQL UNION
    • PL/SQL NOT EQUAL
    • PL/SQL varray
    • PL/SQL Concatenate
    • PL/SQL UPDATE
    • PL/SQL TRIM
    • PL/SQL GROUP BY
    • PL/SQL GOTO
    • PL/SQL Date Functions
    • PL/ SQL having
    • PL/SQL to_DATE
    • PL/SQL NVL
    • PLSQL format date
    • PLSQL mod
    • PLSQL round
    • PL/SQL Boolean
    • PL/SQL exit
    • PL/SQL DECODE
    • PL/SQL ROWNUM
    • PLSQL?pivot
    • PLSQL string functions
    • PL/SQL Block
    • PL/SQL Function
    • PL/SQL Unwrapper
    • PL/SQL Table
    • PL/SQL ALTER TABLE
    • PLSQL execute immediate
    • Triggers in PL/SQL
    • PL/SQL Collections
    • PL/SQL stored procedure
    • PL/SQL Anonymous Block
    • PLSQL Interview Questions
  • TSQL Basic
    • TSQL
    • What is T-SQL
    • T-SQL Commands
    • T-SQL String Functions
    • TSQL Interview Questions
  • SQLite
    • What is SQLite
    • SQLite Commands
    • SQLite Data Types
    • SQLite COUNT
    • SQLite Boolean
    • SQLite autoincrement
    • SQLite select
    • SQLite? Bulk Insert
    • SQLite? add column
    • SQLite? concat
    • SQLite BETWEEN
    • SQLite group by
    • SQLite CASE
    • SQLite group_concat
    • SQLite array
    • SQLite? enum
    • SQLite sum
    • SQLite create table
    • SQLite Alter Table
    • SQLite Create Database
    • SQLite Delete
    • SQLite connection string
    • SQLite Database
    • SQLite Describe Table
    • SQLite Show Tables
    • SQLite exit
    • SQLite create index
    • SQLite foreign key
    • SQLite Stored Procedures
    • SQLite Extension
  • DB2
    • DB2? current date
    • DB2 purescale
    • DB2 backup
    • DB2 restore
    • DB2 C Express
    • DB2 Version
    • DB2? Architecture
    • DB2? Data Types
    • DB2? load
    • DB2? order by
    • DB2 date
    • DB2 NVL
    • DB2? update
    • DB2 warehouse
    • DB2 grant
    • DB2 database
    • DB2 VARCHAR
    • DB2? INSERT
    • DB2 LISTAGG
    • DB2 LIKE
    • DB2 TRUNCATE TABLE
    • DB2 LIST TABLES
    • DB2 between
    • DB2? current timestamp
    • DB2? length
    • DB2? bind
    • DB2 limit rows
    • DB2? export
    • DB2 with
    • DB2 Create Table
    • DB2 case statement
    • DB2 CAST
    • DB2 Functions
    • DB2 Date Functions
    • DB2? row_number
    • DB2 trim
    • DB2? Translate
    • DB2 UNION
    • DB2 timestamp
    • DB2? TIMESTAMPDIFF
    • DB2? replace
    • DB2 merge
    • DB2 COALESCE
    • DB2 ISNULL
    • DB2? explain
    • DB2 Join
    • DB2 alter column
    • DB2 rename column
    • DB2? Describe Table
    • DB2? rename table
    • DB2 List Databases
    • DB2 LUW
    • DB2 Query
    • DB2 GROUP BY
    • DB2 TO_DATE
    • View Serializability in DBMS
    • MariaDB Join
    • MariaDB JSON
    • MariaDB? show databases
    • Dataset Normalization
    • MariaDB Max Connections
    • jdbc connection
    • MariaDB GUI
  • DBMS
    • Introduction To DBMS
    • DBMS ER Diagram
    • What is DBMS?
    • DBMS join
    • DBMS Functions
    • Data Administrator in DBMS
    • DBMS Canonical Cover
    • DBMS Log-Based Recovery
    • DBMS Multivalued Dependency
    • Netezza Database
    • DBMS Concepts
    • DBMS Constraints
    • DBMS_Scheduler
    • B+ Tree in DBMS
    • DBMS_LOB
    • dbms entity
    • DBMS Foreign Key
    • DBMS Users
    • DBMS_Metadata.get_ddl
    • Relational Algebra in DBMS
    • DBMS Components
    • DBMS Features
    • DBMS Models
    • DBMS Relational Model
    • Hashing in DBMS
    • DBMS network model
    • Relationship in DBMS
    • ER Model in DBMS
    • Data Models in DBMS
    • Static Hashing in DBMS
    • Advantages of DBMS
    • dbms_output.put_line
    • DBMS Data Dictionary
    • dbms_xplan.display_cursor
    • Normal Forms in DBMS
    • DBMS helps achieve
    • DBMS 3 tier Architecture
    • Relational Calculus in DBMS
    • Serializability in DBMS
    • File Organization in DBMS
    • DBMS Transaction Processing
    • States of Transaction in DBMS
    • Functional Dependency in DBMS
    • Generalization in DBMS
    • Data Independence in DBMS
    • Lock Based Protocols in DBMS
    • Deadlock in DBMS
    • Integrity Constraints in DBMS
    • Concurrency Control in DBMS
    • Validation Based Protocol in DBMS
    • DBMS Locks
    • Normalization in DBMS
    • Transaction Property in DBMS
    • Specialization in DBMS
    • Aggregation in DBMS
    • Types of DBMS

Related Courses

SQL Certification Course

PL/SQL Certification Course

Oracle Certification Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Special Offer - SQL Certification Course Learn More