MYSQL Data Type Flashcards
- a computer language for storing, manipulating and retrieving data stored in a relational database.
-the standard language for Relational Database System. All the Relational Database Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL Server use SQL as their standard database language.
SQL
SQL Stands for what?
Structured Query Language
-Designed for storing any kind of numeric data, kind of numeric data, such as prices, ages, or quantities.
-If the column is numeric and declared numeric and declared UNSIGNED, the range doubles for the given type.
Numeric Types
What are the two main kinds of numeric types?
- Integer types (whole numbers, without any decimal places or fractional parts
-Floating-point types.
Size : 1 byte
Range (Signed) : -128 to 127
Range (Unsigned) : 0-255
TINYINT
Size : 2 bytes
Range (Signed) : -32768 to 32767
Range (Unsigned) :0 to 65535
SMALLINT
Size : 3 bytes
Range (Signed) : -8388608 to 8388607
Range (Unsigned) :0-16777215
MEDIUMINT
Size : 4 bytes
Range (Signed) : -2147483648 to 2147483647
Range (Unsigned) :0-4294967295
INT
Size : 8 bytes
Range (Signed) : 922337203685477580 to 922337203685477580
Range (Unsigned) :0-1844674407370950000
BIGINT
Size : 4 bytes
Range (Signed) : Varies depending on values
FLOAT
Size : 8 bytes
Range (Signed) : Varies depending on values
DOUBLE
Size : The value of M + 2 byte
Range (Signed) : Varies depending on values
DECIMAL
- The value of a newly inserted row into an _________________ column starts at 1 and increases by 1 for every record that is inserted into the table.
- The column will be added by 1 to the current maximum value. It provides a counter that is useful for creating unique values.
AUTO_INCREMENT
True or False
As a rule, VARCHAR and CHAR types cannot be used in the same table. MySQL automatically changes the types to VARCHAR when you mix the two.
True
-It is a fixed length
-If you declare a _________ , all values stored in this column will be 10 bytes long, even if it is only 3 characters long.
-tables that contain these fixed values are processed faster that those that are made up of VARCHAR types
CHAR
- It is a variable length
-If you declare a _________ and store a value that is only 3 characters long, the total amount of storage space is 4 bytes (the length plus one).
VARCHAR
-A variable length types that can store large amounts of data
-You would use these types when you want to store images, sounds, or large amounts of text, such as Web pages or documents.
- This type over other types is the ability to store vast amounts of data. You can store entire files with this type.
-the ability to store vast amounts of data. You can store entire files with this type. The disadvantage is that they are processed more slowly, and they take up large amounts of space
TEXT AND BLOB
What is the type name of this?
Max Size: 255 bytes
Storage: X+1 bytes
VARCHAR(X)
What is the type name of this?
Max Size: 255 bytes
Storage: X bytes
CHAR(X)
TEXT DATA TYPE
What is the type name of this?
Max Size: 65535 bytes
Storage: X+2 bytes
TEXT
TEXT DATA TYPE
What is the type name of this?
Max Size: 255 bytes
Storage: X+1 bytes
TINYTEXT
TEXT DATA TYPE
What is the type name of this?
Max Size: 1.6MB
Storage: X+3 bytes
MEDIUMTEXT
TEXT DATA TYPE
What is the type name of this?
Max Size: 4.2GB
Storage: X+4 bytes
LONGTEXT
BLOB DATA TYPE
What is the type name of this?
Max Size: 255 bytes
Storage: X+2 bytes
TINYBLOB
BLOB DATA TYPE
What is the type name of this?
Max Size: 65535 bytes
Storage: X+2 bytes
BLOB
BLOB DATA TYPE
What is the type name of this?
Max Size: 1.6 MB
Storage: X+3 bytes
MEDIUMBLOB
BLOB DATA TYPE
What is the type name of this?
Max Size: 4.2 MB
Storage: X+4 bytes
LONGBLOB