Skip to Content

SAP HANA开发者中心(Developer Center)入门指南(下篇)

SAP HANA开发者中心(Developer Center)入门指南(上篇)


选择数据

现在我们有了包含数据的表,是时候选择一些数据了。

右击Table节点,选择SQL Editor

我们准备做一个简单的内连,用ID作为连接,从两张表中选取信息。

运行脚本后,我们就能得到我们要求的所有信息了。

当然,我们能缩小选择,只选取我们感兴趣的字段。


这看起来好多了,但我们同样需要年龄来以便将来做分析。我们再建立一个查询来获取年龄,我们从新的Area表中获取Area信息。

我们得到个漂亮的结果,3张表连在一起。等等,我们有的只是出生日期,而不是实际年龄。


我们再做另一个脚本来获取那信息吧。

我们又近了一步,但我不认为John Smith13,631岁。days_between()给的只是出生至今的日子,但是没有years_between()函数,我们需要自己建立。


首先,我们需要建另一张表。是的,另一张,但这次是由我们的Stored Procedure产生。

ID -> VARCHAR -> 3 -> Key field

NAME -> VARCHAR -> 50

AGE -> VARCHAR -> 3

表准备好了之后,我们继续。新开一个SQL Editor,使用如下代码:

操作完成后,我们能看到 Stored Procedure已经创建完成了。

要运行它,我们需要再新开一个SQL Editor,用如下方法调用:

运行完毕后,我们就能核查Employee表了。

太棒了!名和姓在同一字段里,每个员工的年龄都正确。现在我们能对数据做选择了。或者更棒,我们能创建一个view存储所有信息,从而更快更便捷的访问。


右击 View文件夹,选择 New View

我们准备调出 Employee_View,并使用所有表来建立它。

我们要建立一个连接。按下Plus标志,选择 Insert Talbe来插入所有需要的表。

当我们有了所有的表之后就能创建连接了。

连接完所有表之后,我们会得到这么一个东西……

从这里,我们可以通过右击要使用的字段选择Select来进行选择。

执行之后,我们新的view就准备完毕了。打开它的内容,看看里面有些什么信息。

如果想在HANA Studio里做一些小小的分析,右击View,选择Open Data Preview

点击Analysis按钮

我们以AreaBudget为例来获取图表。

通过改变图形的种类和添加名字,我们能得到一个更有说服力的图表。

甚至还能让信息以表的形式显示,并作为文件下载。

如果这还不足以让你对SAP HANA感兴趣,那问题一定出在你身上……这技术太牛了!

相关内容

SQLScript Small Guide(http://scn.sap.com/docs/DOC-22886)


版权声明

© Copyright 2011 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG.The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.

Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.

HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

Java is a registered trademark of Oracle Corporation.

JavaScript is a registered trademark of Oracle Corporation, used under license for technology invented and implemented by Netscape.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.



Tags:
Former Member