Discussed SQL database Data types with structure. Data types in the SQL database are divided into 3 groups. Different types of queries ar...
Discussed SQL database Data types with structure. Data types in the SQL database are divided into 3 groups. Different types of queries are in SQL.
SQL database Data types
- Numerical data type
- Character data type
- Date time data type
Numerical data type
Integer type
- SMALLINT (For small-sized data)
- INT (For normal-sized data)
- BIGINT (For big sized data)
- Noninteger (Decimal point)
FLOAT
- DOUBLE (M, D) [M= Size/Digit and D=How many numbers you want to see after point]
- DECIMAL (M, D) [M= Size/Digit and D=How many numbers you want to see after decimal point]
Character data type
Char (m)
In Char (m) m is the character size. If we use less than m number of characters then left spaces for characters will be wasted.
Varchar(m)
In Varchar(m) m is the character size. If the number of characters is less than m then it will not waste character spaces. It will optimize the spaces automatically. But it makes the process slow because of its size.
You need to set character types basing on the conditions. If there is a need for faster operations not to think about space size in that case use char. If there is a need to keep limit the size and not to think about speed then use varchar.
Text
Text is used when we want to enter a very big sized character type data.
Date and time data type
For adding date and time you have to use these data types
Year
YEAR (YYYY)
Date
DATE (YYYY- MM-DD)
Time
TIME (HH:MM: SS)
Some more types of data are added such as-
BLOB
This is for adding images or audio to the database table.
LOGICAL
LOGICAL is for adding true-false or yes-no options.

No comments