Let’s understand What is DataTypes in SQL. First, Let’s understand what is Data Type?
A data type defines what kind of value a column can contain. Each column in a relational database table is required to have a name and a data type.
You have to decide what types of data will be stored inside each and every table column when creating an SQL table.
The data type is a label and a guideline for SQL to understand what type of data is expected inside of each column, and it also identifies how SQL will interact with the stored data.
List of DataTypes in SQL
In Oracle SQL we have many datatypes, let’s discuss these all.
varchar2(size) – Variable-length character data.
char(size) – Fixed-length character data.
number(p,s) – Variable length numeric data. Where p is a precision value; s is a scale value. For example, numeric(6,2) is a number that has 4 digits before the decimal and 2 digits after the decimal.
date – Date and Time Values
Long – Variable-length character data up to 2 GB
clob – Character data up to 4 GB
BLOB – Binary data up to 4 GB
Datetime Data Types
You can use several Date Time Data types in SQL :
TIMESTAMP – Date with fractional Seconds
INTERVAL YEAR TO MONTH – Stored as an interval of years and Months
INTERVAL DAY TO SECOND – Stored as an interval of days, hours, minutes and seconds.
The TIMESTAMP data type is an extension of DATE data type.
Like – TIMESTAMP, TIMESTAMP WITH TIME ZONE, TIMESTAMP WITH LOCAL TIME ZONE.
INTERVAL YEAR TO MONTH
The INTERVAL YEAR TO MONTH data type stores a period of time using the YEAR and MONTH DateTime fields.
INTERVAL DAY TO SECOND
The INTERVAL DAY TO SECOND data types stores a period of time using the time in terms of days, hours, minutes and seconds.
Products from Amazon.in
Price: Check on Amazon
Price: INR 29,950.00
Price: INR 15,490.00