Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views2 pages

Numeric Data Types

The document outlines various SQL data types categorized into numeric, string, date and time, boolean, other, and spatial data types. It details specific types such as INT, VARCHAR, DATE, BOOLEAN, and ENUM, along with their characteristics and storage capabilities. Additionally, it notes that variations may exist across different database systems like MySQL and PostgreSQL.

Uploaded by

Sofi Ketema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Numeric Data Types

The document outlines various SQL data types categorized into numeric, string, date and time, boolean, other, and spatial data types. It details specific types such as INT, VARCHAR, DATE, BOOLEAN, and ENUM, along with their characteristics and storage capabilities. Additionally, it notes that variations may exist across different database systems like MySQL and PostgreSQL.

Uploaded by

Sofi Ketema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Numeric Data Types:

1. INT (or INTEGER): Used to store whole numbers (e.g., -2, 0, 100).

2. TINYINT: Used to store very small integers (-128 to 127 or 0 to 255 depending on
signed/unsigned).

3. SMALLINT: Stores small integers (-32,768 to 32,767).

4. MEDIUMINT: Stores medium-sized integers (-8,388,608 to 8,388,607).

5. BIGINT: Used for large integers (-2^63 to 2^63-1).

6. DECIMAL(p, s) or NUMERIC(p, s): Used for fixed-point numbers where p is the precision (total
number of digits) and s is the scale (number of digits after the decimal point).

7. FLOAT: Used for floating-point numbers (single precision).

8. DOUBLE: Used for floating-point numbers (double precision).

9. REAL: Similar to FLOAT, but the exact behavior can vary.

String Data Types:

1. CHAR(n): Fixed-length string of n characters. Padding is added if the string is shorter than n.

2. VARCHAR(n): Variable-length string with a maximum length of n characters.

3. TEXT: Used to store long text strings (up to 65,535 characters).

4. TINYTEXT: A short text string (up to 255 characters).

5. MEDIUMTEXT: Medium-sized text string (up to 16,777,215 characters).

6. LONGTEXT: Very large text string (up to 4GB).

7. BLOB: Binary Large Object, used to store binary data.

8. TINYBLOB: A small binary object (up to 255 bytes).

9. MEDIUMBLOB: A medium-sized binary object (up to 16MB).

10. LONGBLOB: A very large binary object (up to 4GB).

Date and Time Data Types:

1. DATE: Stores date values in the format YYYY-MM-DD.

2. DATETIME: Stores date and time values in the format YYYY-MM-DD HH:MM:SS.
3. TIMESTAMP: Stores the timestamp in YYYY-MM-DD HH:MM:SS format, often used for
automatic tracking of changes.

4. TIME: Stores time values in the format HH:MM:SS.

5. YEAR: Stores a year value in the format YYYY.

Boolean Data Type:

1. BOOLEAN: Stores TRUE or FALSE values, which are stored as 1 (TRUE) and 0 (FALSE).

Other Data Types:

1. ENUM('value1', 'value2', ...): A string object with a predefined set of values. The column can
only store one of the specified values.

2. SET('value1', 'value2', ...): A string object that can store multiple values from a predefined set.
Multiple values can be selected.

Spatial Data Types (for geographic data):

1. POINT: Stores a single point in a 2D space.

2. LINESTRING: Stores a series of points that form a line.

3. POLYGON: Stores a polygon defined by a series of points.

These are some of the most common SQL data types. Keep in mind that different database systems (e.g.,
MySQL, PostgreSQL, SQL Server) may have some variations or additional data types. Let me know if you
need more information on a specific type!

You might also like