Common MySQL data types. Flashcards
Category: Character
Storage: Length of characters + 2 bytes
Notes: Variable-length string with a maximum of 65,535 characters.
Data Type: TEXT
Example: ‘string’
Category: Character
Storage: Length of characters + 1 byte
Notes: Variable-length string with a maximum of N characters; 0 ≤ N ≤ 65,535
Data Type: VARCHAR(N)
Example: ‘string’
Category: Character
Storage: N bytes
Notes: Fixed-length string of length N; 0 ≤ N ≤ 255
Data Type: CHAR(N)
Example: ‘string’
Category: Date and time
Storage: 5 bytes
Notes: Format: YYYY-MM-DD hh:mm:ss; Range: ‘1000-01-01 00:00:00’ to ‘9999-12-31 23:59:59’
Data Type: DATETIME
Example: ‘1776-07-04 13:45:22’
Category: Date and time
Storage: 3 bytes
Notes: Format: hh:mm:ss
Data Type: TIME
Example: ‘1776-07-04 13:45:22’
Category: Date and time
Storage: 3 bytes
Notes: Format: YYYY-MM-DD; Range: ‘1000-01-01’ to ‘9999-12-31’
Data Type: DATE
Example: ‘1776-07-04 13:45:22’
Category: Decimal
Storage: 8 bytes
Notes: Approximate decimal numbers with range: -1.8E+308 to 1.8E+308
Data Type: DOUBLE
Example: 123.4 and -54.29685
Category: Decimal
Storage: 4 bytes
Notes: Approximate decimal numbers with range: -3.4E+38 to 3.4E+38
Data Type: FLOAT
Example: 123.4 and -54.29685
Category: Decimal
Storage: Varies depending on M and D
Notes: Exact decimal number where M = number of significant digits, D = number of digits after the decimal point
Data Type: DECIMAL(M,D)
Example: 123.4 and -54.29685
Category: Integer
Storage: 8 bytes
Notes:
Signed range: -2^63 to 2^63 -1;
Unsigned range: 0 to 2^64 -1
Data Type: BIGINT
Example: 34 and -739448
Category: Integer
Storage: 4 bytes
Notes:
Signed range: -2,147,483,648 to 2,147,483,647;
Unsigned range: 0 to 4,294,967,295
Data Type: INTEGER or INT
Example: 34 and -739448
Category: Integer
Storage: 3 bytes
Notes: Signed range: -8,388,608 to 8,388,607; Unsigned range: 0 to 16,777,215
Data Type: MEDIUMINT
Example: 34 and -739448
Category: Integer
Storage: 2 bytes
Notes:
Signed range: -32,768 to 32,767;
Unsigned range: 0 to 65,535
Data Type: SMALLINT
Example: 34 and -739448
Category: Character
Storage: Length of characters + 2 bytes
Notes:
Variable-length string with a maximum of 65,535 characters.
Data Type: TEXT
Example: ‘string’