a
 
SQLRef.Com 

            SqlRef.Com


SQL BASIC
DATA QUERY LANGUAGE
BASIC FUNCTION
AGGREGATE FUNCTION
DATA MANIPULATION LANGUAGE
DATA DEFINITION LANGUAGE
DATA CONTROL LANGUAGE
OTHERS



Go Daddy $1.99 Domains

Data Type

SQL:2003 pre-defined data types can be categorized into five general types:.

  • Numerics
  • Strings
  • Booleans
  • DateTimes
  • Intervals

Data Type Name General Type Description
INTEGER Numerics Data in INTEGER data type is the exact numeric value that has no fractional part.

INTEGER (precision) OR INT (precision)

SMALLINT Numerics SMALLINT also for Integers but the precision is smaller than INTEGER. Therefore, it takes less space than INTEGER. Precision is the maximum number of digits possible.

SMALLINT (precision)

BIGINT Numerics BIGINT is introduced in SQL:2003 and the precision is bigger than the INTEGER can holds.

BIGINT(precision)

NUMERIC Numerics NUMERIC data type has integer and fractional components. You can specify both the precision and the scale for NUMERIC data type. Scale is the number of digits to the right of the decimal point.

NUMERIC (precision, scale)

DECIMAL Numerics DECIMAL data type also has integer and fractional components similar to the NUMERIC data type.

DECIMAL(precision, scale)

FLOAT Numerics FLOAT accepts an argument that determines precision.

FLOAT[(precision)]

CHAR Strings CHAR holds fixed-length character data. If the value is shorter than the specified length, SQL pad the remaining character spaces with blank. If you don't specify a length, it will take the default length which is 1 character.

CHARACTER(length) OR CHAR(length)

VARCHAR Strings VARCHAR holds variable-length character data. SQL will not pad any character spaces if the value is shorter than the specified length.

VARCHAR(maximum length)

CLOB Strings Known as Character Large OBject. Uses to hold large character string. It cannot be used as PRIMARY KEY and SECONDARY KEY.
BOOLEAN Booleans Boolean data type holds either true or false value.

BOOLEAN

DATE Datetimes The DATE data type stores date value in the year (4), month(2), day(2) format. It can stores data value from year 0001 to 9999.

DATE [WITH TIMEZONE]

TIME Datetimes TIME can be declared to hold time zone or not. TIME WITHOUT TIME ZONE data type stores hours, minutes and seconds values. The hour and minute uses 2 digits respectively, while the second uses 2 digits plus optional factional part. TIME WITH TIME ZONE is similar to the TIME WITHOUT TIME ZONE excepts it has additional information on the time difference from the universal time (UTC). The time difference can vary from -12:59 to +13:00.

TIME [WITH TIMEZONE]

TIMESTAMP WITHOUT TIME ZONE Datatimes TIMESTAMPS WITHOUT TIME ZONE data type stores both date and time information. TIMESTAMP WITH TIME ZONE also similar to the TIMESTAMP WITHOUT TIME ZONE excepts it has additional information on time differences.

TIMESTAMP [WITH TIMEZONE]

INTERVAL Intervals INTERVAL holds the difference between 2 datetimes.



 
| Freebies | Free Trial | Add to Bookmark | Search | Link to Us |
Copyright © 2006 SqlRef.com. All rights reserved.