Skip to Content
初めてのSQL 第3版
book

初めてのSQL 第3版

by Alan Beaulieu, 株式会社クイープ
July 2021
Intermediate to advanced
376 pages
6h 34m
Japanese
O'Reilly Japan, Inc.
Content preview from 初めてのSQL 第3版

6章集合

データベースではデータを1行ずつ処理できますが、リレーショナルデータベースの特徴は何と言っても集合にあります。本章では、さまざまな集合演算子を使って複数の結果セットを組み合わせる方法を調べます。集合論をざっと確認した後は、集合演算子unionintersectexceptを使って複数のデータ集合を組み合わせる方法を具体的に見ていきます。

6.1 入門:集合論

多くの地域では、基本的な集合論が高校生の数学のカリキュラムに含まれています。図6-1のような図を見ると、きっと何かを思い出すはずです。

和

図6-1 和

図6-1の塗りつぶされている部分は、集合Aと集合Bの(union)を表しています。つまり、2つの集合の組み合わせです(重なり合っている部分が含まれるのは一度だけです)。この図に見覚えはあるでしょうか。もしそうなら、その知識を活かすときがついにやってきたのです。見覚えがなくても心配はいりません。いくつかの図を使って簡単に思い描くことができます。

円で表された2つのデータ集合(AおよびB)があり、データの一部が共通しているとしましょう。この共通のデータは図6-1の重なり合っている部分として表されます。集合論はデータ集合の間に重なり合う部分がないと少しつまらないので、どの集合演算でも同じ図を使うことにします。集合論には、2つのデータ集合の重なり合う部分だけを扱う演算があります。この演算は交わり交叉、または共通集合(intersection)と呼ばれます(図6-2)。 ...

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

Googleのソフトウェアエンジニアリング ―持続可能なプログラミングを支える技術、文化、プロセス

Googleのソフトウェアエンジニアリング ―持続可能なプログラミングを支える技術、文化、プロセス

Titus Winters, Tom Manshreck, Hyrum Wright, 竹辺 靖昭, 久富木 隆一

Publisher Resources

ISBN: 9784873119588Other