Field Properties and Types

, - . , . - , . .

, , - . - , .

, . , .

Fields and records in the database




. , "" :

  • , , ;
  • ;
  • ;
  • .

( ).





() . , .

, , "..." "β„– " " ". , , .

Different types of data




, . , , , , . , .

. :

  • , ;
  • , .

.

, .

, . - , .





, . . , . , "" "β„– ".

. , , . , , .

, , . , .

:

  • , ;
  • ;
  • , ;
  • ;
  • ;
  • ;
  • ( ).
Data integrity restrictions




, :

  • - ;
  • ;
  • ;
  • ;
  • ;
  • .

, , , .

, . . TINYINT MySQL, .

. .

. . - 255 .

. :

  • CHAR - 255 . , .
  • VARCHAR, TINYTEXT - 255 , .
  • TEXT, MEMO - 65.535 .
  • MEDIUMTEXT - 16.777.215 .
  • LONGTEXT - 4.294.967.295 .
Types CHAR and VARCHAR




, , , , , . . .

BLOB, .

: , , .

, : , , , .

. , . , .

:

  • TINYINT, - 0 - 255 ( -127 - 128);
  • SMALLINT - 0 65.535 ( -32.768 32.767);
  • MEDIUMINT - 0 16.777.215 ( -8.388.608 8.388.607);
  • INT - 0 4294967295 ( -2.147.483.648 2.147.483.647);
  • BIGINT - 0 18.446.744.073.709.551.615 ( -9.223.372.036.854.775.808 9.223.372.036.854.775.807).

:

  • FLOAT - 24.
  • DOUBLE, REAL - , 53 .

- DECIMAL (NUMERIC). , DOUBLE, , , .

. , TINYINT. . , BIGINT , .

:

  • ;
  • ( ): , , ;
  • ;
  • ;
  • ;
  • ( ).

( ).

- , , . , .

, .

, .

"" "". :

  • DATE - "--", , "2018-04-04";
  • DATETIME - "-- ::", , "2018-04-04 17:51:33";
  • TIME - "--";
  • YEAR - "" (17) "" (2017);
  • TIMESTAMP - , , , . , , "".

.

Field Type DATATIME




- , . : TRUE (, 1) FALSE (, 0).

, , .

. - , , BLOB- (Binary Large Object, ).

, , :

  • BINARY - ;
  • TINYBLOB;
  • BLOB;
  • MEDIUMBLOB;
  • LONGBLOB;
  • OLE- (Object Linking and Embedding, ) - Microsoft Access;

. BLOB- -.

Relational databases




, . - HTML.

ENUM. 65.535 , .

- .

SET. , . . - 64.

Types of fields in databases




. .

When designing and creating a database, it is important to precisely determine the format and integrity constraints of information in each field of each table. Of the suitable types offered by a particular DBMS, it is recommended to choose the one that takes up the least space.




All Articles