Search
 
SCRIPT & CODE EXAMPLE
 

SQL

data types sql

### String Data Types
CHAR(size)	FIXED length string of chars. Size from 0 to 255. Default 1.
VARCHAR(size) VARIABLE length string of chars. Size from 0 to 65535.
BINARY(size) Equal to CHAR(), but stores binary byte strings. Default 1.
VARBINARY(size)	Equal to VARCHAR(), but stores binary byte strings.
TINYBLOB	For BLOBs (Binary Large OBjects). Max length: 255 bytes
TINYTEXT	Holds a string with a maximum length of 255 characters
TEXT(size)	Holds a string with a maximum length of 65,535 bytes
BLOB(size)	For BLOBs. Holds up to 65,535 bytes of data
MEDIUMTEXT	Holds a string with maximum length of 16,777,215 characters
MEDIUMBLOB	For BLOBs. Holds up to 16,777,215 bytes of data
LONGTEXT	Holds string with maximum length of 4,294,967,295 characters
LONGBLOB	For BLOBs. Holds up to 4,294,967,295 bytes of data
ENUM(val1, val2, ...) String object of one or more values. Up to 65535 values.
SET(val1, val2, ...) String object of 0 or more values. Up to 64 values.

### Numeric Data Types
BIT(size)	A bit-value type. Size from 1 to 64. Default is 1.
TINYINT(size) Very small integer. Signed (-128, 127). Unsigned (0, 255).
BOOL	Zero is considered false, nonzero values are considered true.
BOOLEAN	Equal to BOOL
SMALLINT(size) Small integer. Signed (-32768, 32767). Unsigned (0, 65535). 
MEDIUMINT(size)	 Medium integer. Signed (-8388608, 8388607). Unsigned (0, 16777215).
INT(size)  Medium integer. Signed (-2147483648, 2147483647) Unsigned (0, 4294967295). 
INTEGER(size)	Equal to INT(size)
BIGINT(size)  Large integer. Signed (-9223372036854775808, 9223372036854775807). Unsigned (0, 18446744073709551615).
FLOAT(size, d)	Floating point number. Digits after decimal defined by d.
FLOAT(p) Floating point number. p chooses FLOAT(0, 24) or DOUBLE(25, 53).
DOUBLE(size, d)	Normal-size floating point. Digits after "," defined by d.
DOUBLE PRECISION(size, d)	 
DECIMAL(size, d) Exact fixed-point number.
DEC(size, d)	Equal to DECIMAL(size,d)

### Date and Time Data Types
DATE	A date. Format: YYYY-MM-DD. Range: ('1000-01-01' to '9999-12-31')
DATETIME(fsp)  Date and time. Format: YYYY-MM-DD hh:mm:ss. Range: ('1000-01-01 00:00:00' to '9999-12-31 23:59:59').
TIMESTAMP(fsp)  Seconds since Unix epoch ('1970-01-01 00:00:00' UTC). Format: YYYY-MM-DD hh:mm:ss. Range('1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC).
TIME(fsp)   Time. Format: hh:mm:ss. Range: ('-838:59:59' to '838:59:59')
YEAR            Year in four-digit format. Range (1901 to 2155)
Comment

sql data types

# Numeric Types
BIT	TINYINT SMALLINT INT BIGINT DECIMAL NUMERIC FLOAT REAL

# Date & Time Types
DATE TIME DATETIME TIMESTAMP YEAR

# Char & String Types (N) Denotes Unicode Versions
CHAR VARCHAR TEXT NCHAR NVARCHAR NTEXT

# Binary Data Types
BINARY VARBINARY IMAGE

# Misc
CLOB BLOB XML JSON
Comment

sql data types

• number(num) - whole numbers up to num digits
• number(num,num2) - num whole numbers up to num2 decimals
• char(num) - fixed length character/string
• varchar2(num) - used for varying length data
• date - full date
• currency - used for prices 
Comment

PREVIOUS NEXT
Code Example
Sql :: apex for oracle 11g 
Sql :: how to populate a table in MySQL from and existing csv file 
Sql :: postgresql install with ansible 
Sql :: oracle job session 
Sql :: how to print some string in mysql 
Sql :: incorrect datetime value sql table error 1292 
Sql :: t sql return on letters only 
Sql :: mysql write into table 
Sql :: sum function in sql 
Sql :: what is key in sql 
Sql :: How to automatically export database to a csv file 
Sql :: sql output parameters 
Sql :: what is mysql 
Sql :: 3rd height salary sql 
Sql :: ubuntu mysql install and configure 
Sql :: with transaction.atomic(): 
Sql :: how do you insert boolean to postgresql 
Sql :: Create table if not exist with exceptions 
Sql :: constraint sql 
Sql :: restore backupfile discourse 
Sql :: sql examples from framework 
Sql :: sql delete where x or y or z 
Sql :: oracle sql winter time change 
Sql :: SQL BETWEEN OPERATOR With Texts 
Sql :: script to run SP_SPACESED on all tables in DB 
Sql :: how to make trigger in phpmyadmin 
Sql :: executescalar in sql server 
Sql :: multiple like values for single column postgres 
Sql :: SQL IN Operator With Duplicate Values 
Sql :: sql transact create cursor with dynamic tables 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =