扫一扫,访问微社区

QQ登录

只需一步,快速开始

 找回密码
 立即注册

扫一扫,访问微社区

QQ登录

只需一步,快速开始

查看: 5210|回复: 143

SAP HANA数据库 SQL参考手册.

  [复制链接]

64

主题

97

帖子

437

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
437
发表于 2016-7-29 12:03:23 | 显示全部楼层 |阅读模式



目录
符号表示 .............................................................................................................................................. 12
引言 ...................................................................................................................................................... 13
SQL ................................................................................................................................................ 13
支持的语言和代码页.................................................................................................................... 13
注释 .............................................................................................................................................. 13
标识符 .......................................................................................................................................... 13
单引号 .......................................................................................................................................... 14
双引号 .......................................................................................................................................... 14
SQL 保留字.................................................................................................................................... 14
数据类型 .............................................................................................................................................. 16
数据类型的分类 ........................................................................................................................... 16
日期时间类型 ............................................................................................................................... 16
Date 格式 .............................................................................................................................. 16
Time 格式 .............................................................................................................................. 17
Timestamp 格式 .................................................................................................................... 18
日期/时间类型支持的函数: ............................................................................................... 19
数字类型 ....................................................................................................................................... 20
字符类型 ....................................................................................................................................... 21
二进制类型 ................................................................................................................................... 22
大对象(LOB)类型 ..................................................................................................................... 22
SQL 数据类型和列存储数据类型之间的映射 .............................................................................. 23
数据类型转换 ............................................................................................................................... 24
类型常量 ....................................................................................................................................... 27
谓词 ...................................................................................................................................................... 29
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
2
比较谓词 ....................................................................................................................................... 29
范围谓词 ....................................................................................................................................... 29
In 谓词 .......................................................................................................................................... 29
Exists 谓词 ..................................................................................................................................... 29
NULL 谓词 ..................................................................................................................................... 30
CONTAINS 谓词 ............................................................................................................................. 30
操作符 .................................................................................................................................................. 33
一元和二元操作符 ....................................................................................................................... 33
操作符优先级 ............................................................................................................................... 33
算术操作符 ................................................................................................................................... 34
字符串操作符 ............................................................................................................................... 34
比较操作符 ................................................................................................................................... 35
逻辑操作符 ................................................................................................................................... 35
集合操作符 ................................................................................................................................... 35
表达式 .................................................................................................................................................. 36
Case 表达式 .................................................................................................................................. 36
Function 表达式 ............................................................................................................................ 36
Aggregate 表达式 .......................................................................................................................... 37
表达式中的子查询 ....................................................................................................................... 37
SQL 函数 ............................................................................................................................................... 39
介绍 .............................................................................................................................................. 39
数据类型转换函数 ....................................................................................................................... 39
CAST ...................................................................................................................................... 39
TO_ALPHANUM ..................................................................................................................... 39
TO_BIGINT ............................................................................................................................. 40
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
3
TO_BINARY ............................................................................................................................ 40
TO_BLOB ................................................................................................................................ 40
TO_CHAR ............................................................................................................................... 41
TO_CLOB ................................................................................................................................ 41
TO_DATE ................................................................................................................................ 41
TO_DATS ................................................................................................................................ 42
TO_DECIMAL .......................................................................................................................... 42
TO_DOUBLE ........................................................................................................................... 43
TO_INT ................................................................................................................................... 43
TO_INTEGER........................................................................................................................... 43
TO_NCHAR ............................................................................................................................. 44
TO_NCLOB ............................................................................................................................. 44
TO_NVARCHAR ...................................................................................................................... 44
TO_REAL ................................................................................................................................ 45
TO_SECONDDATE ................................................................................................................... 45
TO_SMALLDECIMAL ............................................................................................................... 45
TO_SMALLINT ........................................................................................................................ 46
TO_TIME ................................................................................................................................ 46
TO_TIMESTAMP ..................................................................................................................... 46
TO_TINYINT............................................................................................................................ 47
TO_VARCHAR ......................................................................................................................... 47
日期时间函数 ............................................................................................................................... 47
ADD_DAYS ............................................................................................................................. 47
ADD_MONTHS ....................................................................................................................... 48
ADD_SECONDS ....................................................................................................................... 48
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
4
ADD_YEARS ............................................................................................................................ 48
CURRENT_DATE ..................................................................................................................... 49
CURRENT_TIME ...................................................................................................................... 49
CURRENT_TIMESTAMP........................................................................................................... 49
CURRECT_UTCDATE ............................................................................................................... 50
CURRENT_UTCTIME ............................................................................................................... 50
CURRENT_UTCTIMESTAMP .................................................................................................... 50
DAYNAME .............................................................................................................................. 51
DAYOFMONTH ....................................................................................................................... 51
DAYOFYEAR............................................................................................................................ 51
DAYS_BETWEEN ..................................................................................................................... 52
EXTRACT ................................................................................................................................ 52
HOUR ..................................................................................................................................... 52
ISOWEEK ................................................................................................................................ 53
LAST_DAY............................................................................................................................... 53
LOCALTOUTC.......................................................................................................................... 53
MINUTE ................................................................................................................................. 54
MONTH .................................................................................................................................. 54
MONTHNAME ........................................................................................................................ 54
NEXT_DAY .............................................................................................................................. 55
NOW ...................................................................................................................................... 55
QUARTER ............................................................................................................................... 55
SECOND ................................................................................................................................. 56
SECONDS_BETWEEN .............................................................................................................. 56
UTCTOLOCAL.......................................................................................................................... 56
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
5
WEEK ..................................................................................................................................... 57
WEEKDAY ............................................................................................................................... 57
YEAR ...................................................................................................................................... 57
数字函数 ....................................................................................................................................... 58
ABS ........................................................................................................................................ 58
ACOS ...................................................................................................................................... 58
ASIN ....................................................................................................................................... 59
ATAN...................................................................................................................................... 59
ATAN2 .................................................................................................................................... 59
BINTOHEX .............................................................................................................................. 60
BITAND .................................................................................................................................. 60
CEIL ........................................................................................................................................ 60
COS ........................................................................................................................................ 61
COSH ...................................................................................................................................... 61
COT ........................................................................................................................................ 61
EXP ........................................................................................................................................ 62
FLOOR .................................................................................................................................... 62
GREATEST .............................................................................................................................. 62
HEXTOBIN .............................................................................................................................. 63
LEAST ..................................................................................................................................... 63
LN .......................................................................................................................................... 63
LOG ........................................................................................................................................ 64
MOD ...................................................................................................................................... 64
POWER .................................................................................................................................. 65
ROUND .................................................................................................................................. 65
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
6
SIGN ....................................................................................................................................... 65
SIN ......................................................................................................................................... 66
SINH ....................................................................................................................................... 66
SQRT ...................................................................................................................................... 66
TAN ........................................................................................................................................ 67
TANH ..................................................................................................................................... 67
UMINUS ................................................................................................................................. 67
字符串函数 ................................................................................................................................... 68
ASCII ...................................................................................................................................... 68
CHAR ...................................................................................................................................... 68
CONCAT ................................................................................................................................. 68
LCASE ..................................................................................................................................... 69
LEFT ....................................................................................................................................... 69
LENGTH .................................................................................................................................. 69
LOCATE .................................................................................................................................. 70
LOWER ................................................................................................................................... 70
LPAD ...................................................................................................................................... 71
LTRIM..................................................................................................................................... 71
NCHAR ................................................................................................................................... 71
REPLACE ................................................................................................................................. 72
RIGHT ..................................................................................................................................... 72
RPAD ...................................................................................................................................... 72
RTRIM .................................................................................................................................... 73
SUBSTR_AFTER ....................................................................................................................... 73
SUBSTR_BEFORE .................................................................................................................... 74
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
7
SUBSTRING ............................................................................................................................ 74
TRIM ...................................................................................................................................... 74
UCASE .................................................................................................................................... 75
UNICODE ................................................................................................................................ 75
UPPER .................................................................................................................................... 76
杂项函数 ....................................................................................................................................... 76
COALESCE .............................................................................................................................. 76
CURRENT_CONNECTION ........................................................................................................ 77
CURRENCT_SCHEMA .............................................................................................................. 77
CURRENT_USER ..................................................................................................................... 77
GROUPING_ID ........................................................................................................................ 78
IFNULL ................................................................................................................................... 80
MAP ....................................................................................................................................... 80
NULLIF ................................................................................................................................... 81
SESSION_CONTEXT ................................................................................................................. 82
SESSION_USER ....................................................................................................................... 82
SYSUUID ................................................................................................................................. 83
SQL 语句 ............................................................................................................................................... 85
集合定义和操纵语句.................................................................................................................... 85
ALTER AUDIT POLICY .............................................................................................................. 85
ALTER FULLTEXT INDEX .......................................................................................................... 87
ALTER INDEX .......................................................................................................................... 89
ALTER SEQUENCE ................................................................................................................... 89
ALTER TABLE .......................................................................................................................... 91
CREATE AUDIT POLICY ............................................................................................................ 99
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
8
CREATE FULLTEXT INDEX ...................................................................................................... 101
CREATE INDEX ...................................................................................................................... 103
CREATE SCHEMA .................................................................................................................. 104
CREATE SEQUENCE ............................................................................................................... 105
CREATE SYNONYM ............................................................................................................... 107
CREATE TABLE ...................................................................................................................... 107
CREATE TRIGGER .................................................................................................................. 115
CREATE VIEW ....................................................................................................................... 124
DROP AUDIT POLICY ............................................................................................................. 125
DROP FULLTEXT INDEX ......................................................................................................... 126
DROP INDEX ......................................................................................................................... 127
DROP SCHEMA ..................................................................................................................... 127
DROP SEQUENCE .................................................................................................................. 128
DROP SYNONYM .................................................................................................................. 128
DROP TABLE ......................................................................................................................... 129
DROP TRIGGER ..................................................................................................................... 130
DROP VIEW .......................................................................................................................... 131
RENAME COLUMN ............................................................................................................... 132
RENAME INDEX .................................................................................................................... 132
RENAME TABLE .................................................................................................................... 133
ALTER TABLE ALTER TYPE ..................................................................................................... 134
TRUNCATE TABLE ................................................................................................................. 135
数据操纵语句: ......................................................................................................................... 136
DELETE: ............................................................................................................................. 136
EXPLAIN PLAN ...................................................................................................................... 137
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
9
INSERT ................................................................................................................................. 141
LOAD .................................................................................................................................... 143
MERGE DELTA ...................................................................................................................... 143
REPLACE | UPSERT ............................................................................................................... 144
SELECT ................................................................................................................................. 146
UNLOAD ............................................................................................................................... 158
UPDATE ................................................................................................................................ 158
系统管理语句 ............................................................................................................................. 159
SET SYSTEM LICENSE ............................................................................................................ 159
ALTER SYSTEM ALTER CONFIGURATION ............................................................................... 160
ALTER SYSTEM ALTER SESSION SET ....................................................................................... 162
ALTER SYSTEM ALTER SESSION UNSET .................................................................................. 162
ALTER SYSTEM CANCEL [WORK IN] SESSION ......................................................................... 163
ALTER SYSTEM CLEAR SQL PLAN CACHE................................................................................ 164
ALTER SYSTEM CLEAR TRACES .............................................................................................. 164
ALTER SYSTEM DISCONNECT SESSION .................................................................................. 165
ALTER SYSTEM LOGGING ...................................................................................................... 166
ALTER SYSTEM RECLAIM DATAVOLUME ............................................................................... 166
ALTER SYSTEM RECLAIM LOG ............................................................................................... 167
ALTER SYSTEM RECLAIM VERSION SPACE ............................................................................. 167
ALTER SYSTEM RECONFIGURE SERVICE................................................................................. 168
ALTER SYSTEM REMOVE TRACES .......................................................................................... 168
ALTER SYSTEM RESET MONITORING VIEW............................................................................ 169
ALTER SYSTEM SAVE PERFTRACE .......................................................................................... 170
ALTER SYSTEM SAVEPOINT ................................................................................................... 171
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
10
ALTER SYSTEM START PERFTRACE ........................................................................................ 171
ALTER SYSTEM STOP PERFTRACE .......................................................................................... 172
ALTER SYSTEM STOP SERVICE ............................................................................................... 172
UNSET SYSTEM LICENSE ALL ................................................................................................. 173
会话管理语句 ............................................................................................................................. 173
CONNECT ............................................................................................................................. 173
SET HISTORY SESSION........................................................................................................... 173
SET SCHEMA ........................................................................................................................ 174
SET [SESSION]....................................................................................................................... 174
UNSET [SESSION] .................................................................................................................. 175
事务管理语句 ............................................................................................................................. 176
COMMIT .............................................................................................................................. 176
LOCK TABLE .......................................................................................................................... 176
ROLLBACK ............................................................................................................................ 176
SET TRANSACTION................................................................................................................ 177
访问控制语句 ............................................................................................................................. 178
ALTER SAML PROVIDER ........................................................................................................ 178
ALTER USER .......................................................................................................................... 179
CREATE ROLE ....................................................................................................................... 182
CREATE SAML PROVIDER ...................................................................................................... 183
CREATE USER ....................................................................................................................... 184
DROP ROLE .......................................................................................................................... 186
DROP SAML PROVIDER ......................................................................................................... 187
DROP USER .......................................................................................................................... 187
GRANT ................................................................................................................................. 188
SAP中国社区论坛
www.sapchina.net
SAP HANA 数据库– SQL 参考手册
11
REVOKE ................................................................................................................................ 197
数据导入导出语句 ..................................................................................................................... 198
EXPORT ................................................................................................................................ 198
IMPORT ................................................................................................................................ 200
IMPORT FROM ..................................................................................................................... 202
SQL 语句的限制.................................................................................................................................. 204
SQL 错误代码 ..................................................................................................................................... 207



游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复

使用道具 举报

0

主题

1

帖子

8

积分

新手上路

Rank: 1

积分
8
发表于 2016-8-1 08:49:41 | 显示全部楼层
最近在学习 ,很好的东西
回复 支持 反对

使用道具 举报

1

主题

6

帖子

21

积分

新手上路

Rank: 1

积分
21
发表于 2016-8-3 17:02:36 | 显示全部楼层
又一个手册
回复 支持 反对

使用道具 举报

5

主题

19

帖子

77

积分

注册会员

Rank: 2

积分
77
发表于 2016-8-4 09:38:35 | 显示全部楼层
好东西哦。
回复

使用道具 举报

0

主题

5

帖子

36

积分

新手上路

Rank: 1

积分
36
发表于 2016-8-9 11:42:40 | 显示全部楼层
看看kanakankanaa
回复 支持 反对

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2016-8-12 15:25:36 | 显示全部楼层
感谢分享,学习
回复 支持 反对

使用道具 举报

0

主题

4

帖子

14

积分

新手上路

Rank: 1

积分
14
发表于 2016-9-7 12:10:40 | 显示全部楼层
这个不错,谢谢!!
回复 支持 反对

使用道具 举报

0

主题

7

帖子

20

积分

新手上路

Rank: 1

积分
20
发表于 2016-11-30 10:38:04 | 显示全部楼层
Thaks a lot!
回复

使用道具 举报

0

主题

1

帖子

4

积分

新手上路

Rank: 1

积分
4
发表于 2016-12-6 18:34:06 | 显示全部楼层
tanks 感谢楼主
回复 支持 反对

使用道具 举报

0

主题

4

帖子

12

积分

新手上路

Rank: 1

积分
12
发表于 2016-12-8 16:53:34 | 显示全部楼层
大王叫我来巡山
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

    小黑屋|手机版|Archiver|( 京ICP备13039498号-1 )QQ

GMT+8, 2018-5-24 00:24 , Processed in 0.193591 second(s), 30 queries .

© 2001-2011 Powered by Discuz! X3.4. Theme By SAPChina!

快速回复 返回顶部 返回列表