当前位置:网站首页>Dameng database all
Dameng database all
2022-07-05 06:36:00 【LZYmarks】
install
Refer to the official manual
https://eco.dameng.com/docs/zh-cn/start/install-dm-windows-prepare.html
DM Management tools
https://eco.dameng.com/docs/zh-cn/start/tool-dm-manager.html
Register link
make new connection
Basic function description of the window
View database instance information
adopt DM Management tools can view the information of database instances , Contains an overview of the system , Table usage space , System management , Log files , Archiving configuration and other aspects .
Select the corresponding instance , Right click on the 【 Management server 】, You can view the instance related information , As shown in the figure below :
Common options configuration
Through the configuration of common options , It can help daily operation , Including audit analysis tools , Shortcut key , Data migration tools , Query Analyzer , Management tools and other functions .
Select the management tool 【 window 】, Click on 【 Options 】 function , You can enter the configuration of common options . For example, select query analyzer 【 Editor 】 function , The editor display function can be modified , As shown in the figure below :
Tablespaces and users
Create tablespace
Create user
Create user
Backup of database
Agent job
Create a proxy environment
Create a scheduled backup job
idea Connect to Damon database
https://eco.dameng.com/docs/zh-cn/start/java-development.html
pom Of jar package
<!-- If the driver package reports an error , You can add local drivers -->
<dependency>
<groupId>com.dameng</groupId>
<artifactId>dm-jdbc</artifactId>
<version>1.8</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/DmJdbcDriver18.jar</systemPath>
</dependency>
</dependencies>
<!-- Add image warehouse configuration -->
<repositories>
<!-- Alibaba cloud image warehouse is used to improve download speed -->
<repository>
<id>aliyun</id>
<name>aliyun Repository</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- Use DM To download the driver package -->
<repository>
<id>dc</id>
<name>dc Repository</name>
<url>http://119.96.100.222:8181/repository/maven-releases/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
jar Put the bag here lib Under the table of contents
Advantages of Dameng database
DM Basic concepts of database
https://eco.dameng.com/docs/zh-cn/pm/dm_sql-introduction.html
Reserved words and identifiers
The syntax rules of identifiers are compatible with standards GJB 1382A-9X, Identifiers are divided into two categories: regular identifiers and delimited identifiers .
Formal identifiers are represented by letters 、_、KaTeX parse error: Expected 'EOF', got '#' at position 2: 、#̲ Or start with Chinese characters , It can be followed by letters 、…、# Or Chinese characters , The maximum length of a regular identifier is 128 English characters or 64 The Chinese characters . Regular identifiers cannot be reserved words .
Examples of formal identifiers :A,test1,_TABLE_B, surface 1.
When the identifier body of the delimited identifier is enclosed in double quotation marks , The identifier body can contain any character , Specially , Where two consecutive double quotation marks are used to escape into one double quotation mark .
Examples of delimited identifiers :”table”,”A”,”[email protected]#$“.
For a list of reserved words, see Appendix 1.
General data types
- Character data type
CHAR type
grammar :CHAR[( length )]
function :CHAR The data type specifies a fixed length string . In the base table , Definition CHAR When a column of type , You can specify one that does not exceed 32767 As a positive integer of byte length , for example :CHAR(100). If no length is specified , Default is 1.CHAR The maximum storage length of type columns is determined by the database page size ,CHAR The corresponding relationship between the maximum storage length of data type and page size is shown in the following table 1.4.1. however , In expression evaluation , The maximum length of this type is not limited by the page size , by 32767.
This limit length only applies to the columns in the base table , When defining variables , Can not be limited by the length of this limit . in addition , The length of the column actually inserted into the table is constrained by the length of the record , The total length of each record cannot be greater than half the page size
CHARACTER type
grammar :CHARACTER[( length )]
function : And CHAR identical .
VARCHAR type /VARCHAR2 type
grammar :VARCHAR[( length )]
function :VARCHAR The data type specifies a variable length string , Usage is similar. CHAR data type , You can specify one that does not exceed 32767 As a positive integer of byte or character length , for example :VARCHAR (100) Appoint 100 bytes ;VARCHAR(100 CHAR) Appoint 100 Character length . If no length is specified , Default is 8188 byte .
In the base table , When not specified USING LONG ROW When storing options , Insert VARCHAR The actual maximum storage length of the data type is determined by the database page size , The specific maximum length algorithm is shown in table 1.4.1; If you specify USING LONG ROW Storage options , The insert VARCHAR The length of the data type is not limited by the database page size .VARCHAR The maximum length of a type in expression evaluation is not limited by the page size , by 32767;
CHAR Same as VARCHAR The difference between When the length of the former is insufficient , The system automatically fills in spaces , The latter only takes up the actual byte space . in addition , The length of the column actually inserted into the table is constrained by the length of the record , The total length of each record cannot be greater than half the page size .
VARCHAR2 The type and VARCHAR The type usage is the same .
Numerical data type
Exact numeric data type
NUMERIC type
grammar :NUMERIC[( precision [, scale ])]
( precision = There are several numbers 3.124 The accuracy of is 4 Scale is 3 ,1414.1 The accuracy of is 5 Scale is 1)
function :NUMERIC The data type is used to store Zero 、 Positive and negative fixed point numbers . among : Precision is an unsigned integer , Defines the total number of digits , The accuracy range is 1 to 38. The scale defines the number of digits to the right of the decimal point . The scale of a number should not be greater than its accuracy , If the actual scale is greater than the specified scale , Then the number of digits beyond the scale will be rounded and omitted . for example :NUMERIC(4,1) Defines the decimal point before 3 Place and after decimal point 1 position , common 4 Digit number , The scope is -999.9 To 999.9. all NUMERIC data type , If its value exceeds the accuracy ,DM An error message will be returned , If the scale is exceeded , Then the extra bits will be truncated .
If precision and scale are not specified , The default precision is 38, The scale is infinite .
DECIMAL type
grammar :DECIMAL[( precision [, scale ])]
function : And NUMERIC be similar .
DEC type
grammar :DEC[( precision [, scale ])]
function : And DECIMAL identical .
NUMBER type
grammar :NUMBER[( precision [, scale ])]
function : And NUMERIC identical .
INTEGER type
grammar :INTEGER
function :** Used to store signed integers , Accuracy of 10, Scale is 0.** The value range is :-2147483648 (-231)~ +2147483647(231-1).
INT type
grammar :INT
function : And INTEGER identical .
BIGINT type
grammar :BIGINT
function :** Used to store signed integers , Accuracy of 19, Scale is 0.** The value range is :-9223372036854775808(-263)~9223372036854775807(263-1).
TINYINT type
grammar :TINYINT
function : Used to store signed integers , Accuracy of 3, Scale is 0. The value range is :-128 ~ +127.
BYTE type
grammar :BYTE
function : And TINYINT be similar , Accuracy of 3, Scale is 0.
SMALLINT type
grammar :SMALLINT
function : Used to store signed integers , Accuracy of 5, Scale is 0. The value range is :-32768(-215) ~ +32767(215-1).
BINARY type
grammar :BINARY[( length )]
function :BINARY The data type is used to store fixed length binary data . In the base table , Definition BINARY When a column of type , The maximum storage length is determined by the database page size , You can specify a positive integer that does not exceed its maximum storage length as the column length , The default length is 1 Bytes . The maximum storage length is shown in table 1.4.1.BINARY The upper limit of type length in expression evaluation is 32767.BINARY Constant to 0x Start , Followed by the hexadecimal representation of the data , for example 0x2A3B4058.
VARBINARY type
grammar :VARBINARY[( length )]
function :VARBINARY Data types are used to store variable length binary data , Usage is similar. BINARY data type , You can specify one that does not exceed 32767 As the data length . The default length is 8188 Bytes .VARBINARY The actual maximum storage length of the data type is determined by the database page size , Specific maximum length algorithm and VARCHAR Of the same type , The upper limit of its length in expression calculation is also the same as VARCHAR The same type , by 32767.
Approximate numerical data type
FLOAT type
grammar :FLOAT[( precision )]
function :FLOAT Is a floating-point number with binary precision . This type directly uses the standard C In language DOUBLE. The precision value setting has no practical significance , Precision settings are used to ensure the compatibility of data migration , The actual accuracy is fixed inside Damon . The accuracy is in the range (1~126) Precision is ignored , If it exceeds this range, an error will be reported directly .
FLOAT Value range -1.710308 ~ 1.710308.
DOUBLE type
grammar :DOUBLE[( precision )]
function :DOUBLE Is a floating-point number with binary precision .DOUBLE The setting of type is for the compatibility of migration . This type directly uses the standard C In language DOUBLE. Accuracy and value range usage and FLOAT Exactly the same as .
REAL type
grammar :REAL
function :REAL Is a floating-point number with binary precision , But it cannot be specified by the user , The system specifies its binary precision as 24, Decimal precision is 7. Value range -3.41038 ~ 3.41038.
DOUBLE PRECISION type
grammar :DOUBLE PRECISION[( precision )]
function : This type indicates a double precision floating-point number .DOUBLE PRECISION The setting of type is for the compatibility of migration . This type directly uses the standard C In language DOUBLE. Accuracy and value range usage and FLOAT Exactly the same as .
Bit string data type
BIT type
grammar :BIT
function :BIT Type is used to store integer data 1、0 or NULL, Only 0 It turns to false , Other non empty 、 Not 0 Values are automatically converted to true , Can be used to support ODBC and JDBC The Boolean data type of .DM Of BIT The type and SQL SERVER2000 Of BIT Data types are similar .
Function and ODBC and JDBC Of bool identical .
Date time data type
Date and time data types are divided into general date and time data types 、 There are three types of time interval data types and time zone data types , Used to store dates 、 Time and interval information between them .
General date and time data types
DATE type
grammar :DATE
function :DATE Type includes year 、 month 、 Daily information , Defined ’-4712-01-01’ and ’9999-12-31’ Any valid Gregory date between .DM Support the Julian calendar , It also takes into account the historical anomalies of the transition from the Julian calendar to the Gregorian date , Don't count ’1582-10-05’ To ’1582-10-14’ Between 10 God .
DM Support SQL92 Standard or SQL SERVER Of DATE Word value , for example :DATE’1999-10-01’、’1999/10/01’ or ’1999.10.01’ It's all valid DATE value , And equal to each other . The first non 0 Before the value 0 You can also omit , for example ’0001-01-01’ Equivalent to ’1-1-1’.
TIME type
grammar :TIME[( Decimal second precision )]
function :TIME Types include 、 branch 、 Second information , Define one in ’00:00:00.000000’ and ’23:59:59.999999’ Effective time between .TIME Type decimal second precision specifies the number of digits after the decimal point in the second field , The value range is 0~6, If not defined , The default precision is 0.
DM Support SQL92 Standard or SQL SERVER Of TIME Word value , for example :TIME ‘09:10:21’,’09:10:21’ or ’9:10:21’ It's all valid TIME value , And equal to each other .
TIMESTAMP type
grammar :TIMESTAMP[( Decimal second precision )]
function :TIMESTAMP Type includes year 、 month 、 Japan 、 when 、 branch 、 Second information , Define one in ’-4712-01-01 00:00:00.000000’ and ’9999-12-31 23:59:59.999999’ Between the effective Gregory date and time .TIMESTAMP Type decimal second precision specifies the number of digits after the decimal point in the second field , The value range is 0~6, If not defined , The default precision is 6. And DATE The same type ,DM Don't count ’1582-10-05’ To ’1582-10-14’ Between 10 God .
DM Support SQL92 Standard or SQL SERVER Of TIMESTAMP Word value , for example :TIMESTAMP ‘2002-12-12 09:10:21’ or ’2002-12-12 9:10:21’ or ’2002/12/12 09:10:21’ or ’2002.12.12 09:10:21’ It's all valid TIMESTAMP value , And equal to each other .
In the syntax ,TIMESTAMP It can also be written as DATETIME.
Japan - Time interval
INTERVAL DAY type
grammar :INTERVAL DAY[( Guidance accuracy )]
function : Describe an interval of several days , The guidance accuracy specifies the value range of the day . The value range of guidance accuracy is 1~9, If not defined , The default precision is 2. for example :INTERVAL DAY(3), among DAY (3) The precision of the day is 3, Indicates that the range is negative 999 The sun is coming 999 Japan . An example of a suitable word value is :INTERVAL ‘150’ DAY.
INTERVAL DAY TO HOUR type
grammar :INTERVAL DAY[( Guidance accuracy )] TO HOUR
function : Describe an interval of days and hours , The guidance accuracy specifies the value range of the day . The value range of guidance accuracy is 1~9, If not defined , The default precision is 2. The value range of time is 0 To 23 Between . for example :INTERVAL DAY(1) TO HOUR, among DAY(1) The precision of the day is 1, Indicates that the range is negative 9 Day zero 23 Hour to hour 9 Day zero 23 Hours . An example of a suitable word value is :INTERVAL ‘9 23’ DAY TO HOUR.
There are still a lot of it
Multimedia data types
There are two formats for word values of multimedia data types : One is string , for example :’ABCD’, Two is BINARY, Such as 0x61626364.
TEXT、LONG、LONGVARCHAR、CLOB Only strings are supported .
BFILE The above two formats are not applicable .BFILE The specified file can only be accessed read-only .
Specifying precision for fields of multimedia data types is not supported .
TEXT type
grammar :TEXT
function :TEXT Is a variable length string type . The maximum length of its string is 100G-1 byte .DM Use it to store long text strings .
LONG、LONGVARCHAR( also called TEXT) type
grammar :LONG/LONGVARCHAR
function : And TEXT identical .
IMAGE type
grammar :IMAGE
function :IMAGE Used to indicate the image type in multimedia information . The image is composed of an indefinite pixel lattice , Maximum length 100G-1 byte . In addition to storing image data , It can also be used to store any other binary data .
LONGVARBINARY( also called IMAGE) type
grammar :LONGVARBINARY
function : And IMAGE identical .
BLOB type
grammar :BLOB
function :BLOB Type is used to indicate variable length binary large objects , Maximum length 100G-1 byte .
CLOB type
grammar :CLOB
function :CLOB Type is used to indicate a variable length alphanumeric string , Maximum length 100G-1 byte .
BFILE type
grammar :BFILE
function :BFILE Used to indicate binary files stored in the operating system , Files are stored in the operating system rather than in the database , Only read-only access .
Operator
Unary operator + and -
select -(-5), +NOWPRICE from PRODUCTION.PRODUCT WHERE NOWPRICE<10;
The result is :
5 6.1000
notes : stay SQL Because of the two short horizontal “–”, Express “ Comment start ”, Then the double minus sign must be -(-5), instead of –5.
When used between expressions +、-、*、/ when , Respectively means plus 、 reduce 、 ride 、 In addition to the operation . The accuracy of the results is specified as follows :
Only operations of exact numeric data types
The result type of two integer operations of the same type remains unchanged , The result type of two different types of integer operations is converted to the integer type with a larger range .
Integers and NUMERIC,DEC Etc ,SMALLINT The precision of type is fixed to 5, Scale is 0;INTEGER The precision of type is fixed to 10, Scale is 0;BIGINT The precision of type is fixed to 19, Scale is 0.
exp1+exp2 The precision of the result is the integer part length of the two ( Precision - scale ) The sum of the maximum value of and the maximum value of the two scales , The scale is the maximum of the two scales ;
exp1-exp2 The precision of the result is the sum of the maximum length of their integer parts and the maximum value of their scales , The scale is the maximum of the two scales ;
exp1*exp2 The precision of the result is the sum of the two , The scale is also the sum of the two scales ;
exp1/exp2 The result is NUMERIC type ( The default precision is 38, The scale is not limited ).
https://eco.dameng.com/docs/zh-cn/pm/dm_sql-introduction.html
String expressions
Connect ||
grammar :STR1 || STR2
(STR1 Representative string 1,STR2 Representative string 2)
The join operator operates on two operands , Each of them is the evaluation of strings belonging to the same character set . It concatenates strings in a given order , And return a string . Its length is equal to the sum of the lengths of the two operands . If one of the two operands is NULL, be NULL Equivalent to empty string .
example
select ‘ wuhan ’ || ADDRESS1 from PERSON.ADDRESS WHERE ADDRESSID=3;
The result is :
Qingcuiyuan, Qingshan District, Wuhan 1 Number
DM_SQL Language supported database schema
DM_SQL Three level relational database schema support , The external schema corresponds to the view and part of the base table , The schema corresponds to the base table , The base table is an independent table . One or more base tables are stored in a storage file , The logical structure in the storage file constitutes the internal schema of the relational database .DM_SQL The language itself does not provide manipulation statements for internal patterns .
Views are tables exported from base tables or other views ,DM Only save the definition of the view in the data dictionary . The definition is actually a query statement , Then take a name for the query statement, that is, the view name . Every time the view is called , In fact, it is to execute its corresponding query statement , The exported query result is the data of this view . So the view does not have its own data , It's a virtual table , Its data is still stored in the base table that exports the view . When the data in the base table changes , The data queried in the view also changes , therefore , The view is like a window , Through it, users can see the data within their permissions . Once defined, views can also be shared by multiple users , It is as convenient to do some operations similar to the base table on the view as it is on the base table .
in summary ,SQL The language's support for the three-level schema of relational database is shown in the following figure .
边栏推荐
- The route of wechat applet jumps again without triggering onload
- NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
- International Open Source firmware Foundation (osff) organization
- 4. Object mapping Mapster
- LSA Type Explanation - detailed explanation of lsa-2 (type II LSA network LSA) and lsa-3 (type III LSA network Summary LSA)
- C Primer Plus Chapter 15 (bit operation)
- [leetcode] day95 effective Sudoku & matrix zeroing
- Application of recyclerview
- Relevant information of National Natural Science Foundation of China
- Sum of three terms (construction)
猜你喜欢
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
2. Addition and management of Oracle data files
1.手动创建Oracle数据库
Game theory acwing 892 Steps Nim game
栈 AcWing 3302. 表达式求值
Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations
P2575 master fight
Vscode creates its own code template
Bit of MySQL_ OR、BIT_ Count function
求组合数 AcWing 887. 求组合数 III
随机推荐
Find the combination number acwing 887 Find combination number III
Adg5412fbruz-rl7 applies dual power analog switch and multiplexer IC
'mongoexport 'is not an internal or external command, nor is it a runnable program or batch file.
confidential! Netease employee data analysis internal training course, white whoring! (attach a data package worth 399 yuan)
The “mode“ argument must be integer. Received an instance of Object
Genesis builds a new generation of credit system
H5 module suspension drag effect
ollvm编译出现的问题纪录
SQL三种连接:内连接、外连接、交叉连接
Presentation of attribute value of an item
How to answer when you encounter a jet on CSDN?
Day 2 document
AE tutorial - path growth animation
微信小程序路由再次跳轉不觸發onload
博弈论 AcWing 893. 集合-Nim游戏
NotImplementedError: Cannot convert a symbolic Tensor (yolo_boxes_0/meshgrid/Size_1:0) to a numpy ar
[learning] database: several cases of index failure
vsCode创建自己的代码模板
如何正确在CSDN问答进行提问
Financial risk control practice -- feature derivation based on time series