Skip to Content
Trino 权威指南:原书第2版
book

Trino 权威指南:原书第2版

by Matt Fuller, Manfred Moser, Martin Traverso
July 2023
Intermediate to advanced
278 pages
5h 40m
Chinese
China Machine Press
Content preview from Trino 权威指南:原书第2版
166
9
高级 SQL 特性
如第
8
章所述,利用
SQL
语句的强大功能可以实现很多操作,但你对
Trino
中的查询还
只是略知皮毛。本章将涉及更多的高级特性,如函数、运算符和其他功能等。
9.1
函数和运算符介绍
到目前为止,你已经了解了一些基本的知识,包括数据源目录(
catalog
、库(
schema
)、
表(
table
、数据类型和各种
SQL
语句等。这些知识在
Trino
中查询一个或多个
catalog
的一个或多个表的数据时非常有用。在那些例子中,我们主要借助表中不同属性(或列)
的数据编写查询语句。
SQL
函数和运算符的存在则是为了实现更复杂、更全面的
SQL
查询。本章将重点介
Trino
所支持的函数和运算符,并提供使用示例。
SQL
中的函数和运算符在内部等价。函数一般使用的语法形式是
function_name
(function_arg1, ...)
,而运算符使用不同的语法,类似于编程语言和数学中的运算
符。运算符是常用函数的语法缩写和改进形式。运算符与函数相互等价的一个例子是
||
运算符和
concat()
函数,二者都是用来连接字符串的。
SQL
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’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
QuotationMarkI 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
QuotationMarkI’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
QuotationMarkI'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.
Mark W.
Embedded Software Engineer

You might also like

What Successful Brick-and-Mortar Retailers Get Right

What Successful Brick-and-Mortar Retailers Get Right

Rob Angell
Three Essentials for Agentic AI Security

Three Essentials for Agentic AI Security

Paolo Dal Cin, Daniel Kendzior, Yusof Seedat, Renato Marinho
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer

Publisher Resources

ISBN: 9787111731603