SELECT nation.name || ' / ' || region.name AS Location
FROM tpch.sf1.region JOIN tpch.sf1.nation
ON region.regionkey = nation.regionkey
AND region.name LIKE 'AFRICA'
ORDER BY Location;
Location
-------------------
ALGERIA / AFRICA
ETHIOPIA / AFRICA
KENYA / AFRICA
MOROCCO / AFRICA
MOZAMBIQUE / AFRICA
(5 rows)
除了这些运算符,
Trino
还支持各种各样的函数。它们的范围从简单的用例到非常复杂
的功能。在
Trino
中,可以使用
SHOW
FUNCTIONS
语句显示这些函数的列表。
下面是一个简单的示例,它可以计算所有订单的平均价格,并输出四舍五入后的整
数值:
SELECT cast(round(avg(totalprice)) AS integer) AS average_price
FROM tpch.sf1.orders;
average_price
--------------
151220
(1 row)
关于
SQL
使用的更多详细信息,参见
Trino
的文档和本书第
8
章。
Trino
官方网站上有
函数和运算符的相关信息,第
9
章也提供了很好的概览和更多示例。
3.7
小结
Trino
已经可以启动并运行,你可以连接到一个数据源并使用 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.