当前位置:网站首页>Gbase8s database type
Gbase8s database type
2022-07-02 21:33:00 【KnowledgeCloud】
SQL The database type specifies the value range of an attribute . The data type directly corresponds to the concept of domain in the relational model . Each attribute in the relationship must come from a domain . Accordingly , The value of each column in the table must conform to the data type specified when defining the table . The data type is shown in the following figure :
Common data types and descriptions are as follows :
Numerical type (Numeric) INTEGER/INT SERIAL SERIAL8 SMALLINT BIGINT BIGSERIAL DECIMAL NUMERIC(p,s) REAL or SMALLFLOAT FLOAT DOUBLE PRECISION Money(p,s) Time type (TIME) DATE DATETIME INTERVAL | Character (CHARACTER) CHAR(n) CHARACTER VARYING(n,r) VARCHAR(n,r) LVARCHAR(n) NCHAR(n) NVARCHAR(m,r) Big object (Large Objects) BYTE TEXT BLOB CLOB Boolean type (BOOLEAN) BOOLEAN |
1. value type
(1)INTEGER/INT
4 Bytes , by -(231-1) To 231-1 The integer of .
(2)INT8 or BIGINT
8 Bytes , by -(263-1) To 263-1 The integer of .
(3)BIGINT
be better than INT8.
(4)SMALLINT
2 Bytes , by -(215-1) To 215-1 The integer of .
(5)SERIAL
4 Bytes , by 1 To 231-1 The positive integer , Automatically incremented by the server .
(6)SERIAL8 or BIGSERIAL
8 Bytes , by 1 To 263-1 The positive integer , Automatically incremented by the server .
(7)BIGSERIAL
be better than SERIAL8.
(8)FLOAT or DOUBLE PRECISION
Double precision floating point , Yes 16 A significant .
(9)SMALLFLAOT or REAL
Single-precision floating-point , Yes 8 A significant .
(10)DECIMAL(p,s) or NUMERIC(p,s)
Fixed point decimals , Among them p It's the total number of digits ,s It's the number of digits to the right of the decimal point .
(11)MONEY(p,s)
Monetary value , And DECIMAL be similar , Format with currency characters .
2. Character type
(1)CHAR(n)/CHARACTER(n)
Fixed length string ,n Is the length of a string , The default is 1 byte . If the length is less than n, Then fill in the blanks to n Characters .n The maximum value of is 32767.
(2)VARCHAR(n,r)/CHARACTERVARYING(n,r)
Variable length string ,n Is the maximum byte length ,r Is the minimum reserved space ; If the length of the stored value is less than r, Then fill in the blanks to r Characters ; If the length of the stored value is greater than r But less than n, Then it only takes up the space needed to store data .n The maximum value of is 255.
(3)LVARCHAR(n)
Variable length string ,n Is the maximum byte length , The default is 2048 byte . Use only the space needed to store data ,n The maximum value of is 32739.
(4)NCHAR(n)
Fixed length string , Including the use of Global Language Support(GLS) Store single byte and multi byte character sets determined by the database region ; Local collation order is also allowed .
(5)NVARCHAR(n,r)
Variable length string , The meaning of parameter is the same as VARCHAR, Have and NCHAR Similar special properties .
How to choose char perhaps varchar ?
char(1) Occupy 1 byte , and Varchar(1) Occupy 2 byte .
For fixed length, choose char,N<20 And little change in the case of choice char, In particular, you need to create index Field of , You should choose char, Instead of varchar.
3. Time type
(1)Date
The default format is MM/DD/YY, It can be done by GL_DATE Environment variable modification .
(2)DATETIME
Date time , The default format is YYYY-MM-DD HH:MM:SS:FFF, Can pass GL_DATETIME Modify the format of environment variables :
Datetime year to second,
Datetime year to fraction(5),
(3)INTERVAL
time span , Format and DATETIME identical .
4. Big object
Simple large objects have the following types .
(1)BYTE
The maximum is 2GB.
(2)TEXT
The maximum is 2GB.
Intelligent large objects have the following types .
<1> BLOB Binary big object , The maximum is 4TB, Used to store binary data .
<2> CLOB Character large object , The maximum is 4TB, For text data .
5. Boolean type
BOOLEAN:'t' or 'f'.
边栏推荐
- MySQL learning record (2)
- Cardinality sorting (detailed illustration)
- Report on investment development and strategic recommendations of China's vibration isolator market, 2022-2027
- How does esrally perform simple custom performance tests?
- MySQL learning record (1)
- Research Report on minimally invasive medical robot industry - market status analysis and development prospect prediction
- Golang string segmentation
- Research and Analysis on the current situation of China's clamping device market and forecast report on its development prospect
- Internet Explorer ignores cookies on some domains (cannot read or set cookies)
- Research Report on the overall scale, major manufacturers, major regions, products and applications of micro hydraulic cylinders in the global market in 2022
猜你喜欢
D4:非成对图像去雾,基于密度与深度分解的自增强方法(CVPR 2022)
Investment strategy analysis of China's electronic information manufacturing industry and forecast report on the demand outlook of the 14th five year plan 2022-2028 Edition
rwctf2022_ QLaaS
Cardinality sorting (detailed illustration)
Internal/validators js:124 throw new ERR_ INVALID_ ARG_ Type (name, 'string', value) -- solution
Hot backup routing protocol (HSRP)
One week dynamics of dragon lizard community | 2.07-2.13
qwb2018_ core kernel_ rop
[shutter] statefulwidget component (floatingactionbutton component | refreshindicator component)
[shutter] the shutter plug-in is used in the shutter project (shutter plug-in management platform | search shutter plug-in | install shutter plug-in | use shutter plug-in)
随机推荐
Research Report on the overall scale, major manufacturers, major regions, products and applications of friction dampers in the global market in 2022
Spend more time with your computer on this special holiday, HHH
Research Report on ranking analysis and investment strategic planning of RFID market competitiveness of China's industrial manufacturing 2022-2028 Edition
Plastic floating dock Industry Research Report - market status analysis and development prospect forecast
[12] the water of the waves is clear, which can wash my tassel. The water of the waves is muddy, which can wash my feet
Accounting regulations and professional ethics [17]
Happy Lantern Festival! Tengyuanhu made you a bowl of hot dumplings!
Roommate, a king of time, I took care of the C language structure memory alignment
How does esrally perform simple custom performance tests?
Construction and maintenance of business websites [9]
Send blessings on Lantern Festival | limited edition red envelope cover of audio and video is released!
Makefile: usage of control functions (error, warning, info)
Sword finger offer (I) -- handwriting singleton mode
Go language learning summary (5) -- Summary of go learning notes
Research Report on the overall scale, major manufacturers, major regions, products and applications of battery control units in the global market in 2022
Welfare | Hupu isux11 Anniversary Edition is limited to hand sale!
Research Report on crude oil tanker industry - market status analysis and development prospect forecast
Download vagrant box file locally from Atlas and configuring it
6 pyspark Library
暑期第一周总结