Data types of MySQL database

Data types of MySQL database

Each column in a database table is required to have a name and a data type.

An SQL developer must decide what type of data that will be stored inside each column when creating a table. The data type is 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.

Data types table

Data types Description Example

INT

The whole number in range (-2147483648 ... 2147483647)

23; -5

DECIMAL

A fixed-point number 4.5; -0.003

 VARCHAR(size)

String (0-65535 chatacters)

"+7 777 777 77 77";

"Computer science is ..."

BOOL,

BOOLEAN

Zero is considered as false, nonzero values are considered as true.

True; 

False

BLOB(size) For BLOBs (Binary Large OBjects). Holds up to 65,535 bytes of data (picture)
FLOAT, DOUBLE A floating point number 0.3 * 105
INT (AUTO_INCREMENT) Usually is used as a primary key 1; 2; 3; ...

More about Data types

Example

Table "Users"

Different fields have own data type.


Questions:

1. Name three data types.

2. Name three integer data types.

3. Give examples for different five data types.


Exercises:

Ex. 1

Ex. 2


Exam questions:


 

Категория: Relational databases | Добавил: bzfar77 (02.11.2020)
Просмотров: 180 | Теги: Double, Time, varchar, Date, MySQL, data type, Float, Boolean, database, int, integer | Рейтинг: 0.0/0
Всего комментариев: 0
avatar