Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
SQL実践入門night_LT資料_YASU11552288
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Anntoque
January 24, 2018
Programming
590
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
SQL実践入門night_LT資料_YASU11552288
Anntoque
January 24, 2018
More Decks by Anntoque
See All by Anntoque
【試されDATA SAPPORO #1】データ基盤を「育てる」コミュニケーション
anntoque
0
30
【Sapporo Data Pioneers #1 】データのライフサイクルとSapporo Data Pioneersの思いについて
anntoque
1
720
【istyle Data Talk #01】越境できるデータの組織・人材を目指して/ istyle data talk 01 Data Organization
anntoque
1
1.1k
what Azure Synapse
anntoque
0
3.2k
REDASH JOURNEY
anntoque
0
1.5k
データドリブンを提供するサービス Brand Officialのアーキテクチャ / brand official architecture
anntoque
0
1.7k
理想の自分を忘れないために Slack and LINE bot を作った話 / Make Slack API and LINE bot to not forget ideal myself
anntoque
0
950
redash運用アンチパターン
anntoque
0
3.6k
Other Decks in Programming
See All in Programming
テストを司るデーモンに会いに行く 〜隔離した仮想マシンでテストを通すまで〜
h1d3mun3
1
580
iOSDC2026登壇資料.pdf
riofujimon
0
190
setup-vp GitLab対応の裏側
naokihaba
0
130
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
160
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
260
Agents on Rails - Rails at Scale 2026
irinanazarova
0
270
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
270
AWSに止められる覚悟してますか?
morizo_1984
2
400
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.4k
AI Agent時代のリアーキテクチャ戦略と実践
hokaccha
9
5k
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
170
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
800
Featured
See All Featured
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
450
Paper Plane
katiecoart
PRO
4
53k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
420
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
New Earth Scene 8
popppiees
4
2.6k
Deep Space Network (abreviated)
tonyrice
0
320
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
390
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
560
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
Raft: Consensus for Rubyists
vanstee
142
7.7k
Technical Leadership for Architectural Decision Making
baasie
3
580
BBQ
matthewcrist
89
10k
Transcript
SELECT * FROM presto_good_point LIMIT 2 @YASU11552288
LT初めてマンです - 山本 泰毅 (Yamamoto Yasutaka) - 株式会社アイスタイル - データエンジニア
* ビッグデータ分析基盤の構築・運用 * クエラー
DBの選択肢がたくさんの時代 弊社に関わるサービスの DB一覧 RDB - Oracle, SQL server, MySQL, MariaDB,
PostgreSQL etc. NoSQL - Hadoop, BigQuery etc.
異機種のDBをつなげて、SELECTしたいけど… ①DBの機能 - SQL ServerのOpen Query - 1つのSQLの中に複数の記法が混在 - MariaDBのconnect
storage engine - 対応機種が少ない ③VLOOKUP ②クラウドにバッチで全突っ込み - リアルタイム性がない -
Prestoを使うと可読性の高いSQLでつなげれる Prestoとは - 分散型のSQLクエリエンジン (https://prestodb.io/) - インメモリでサクサク - zhicwu/presto -
Docker Hub ※ そのままdocker runして実行すると、 ワーカー名に関するエラーが出るので変更必要 クライアント (BIツール、アナリストなど) SQL etc.
接続するDBの設定をして、SQLを書くまでの流れ STEP 1 カタログに接続情報を書き込む $ cat /export/presto/data/etc/catalog/sample.properties connector.name=sqlserver connection-url=jdbc:sqlserver://hostname;databaseName=sampledb connection-user=xxxx
connection-password=xxxx STEP 2 SQLを実行 SELECT * FROM catalog_name.database_name.table_name mssql JOIN other_catalog_name.database_name.table_name mysql ON msslq.id = mysql.id
本題!map_aggで縦横変換しようとすると… - map_aggとは? - MapReduce向けに実装されている関数 (Hive etc.) - 縦横変換とは -
ピボット - SUM(CASE WHEN hoge = 1 THEN 1 ELSE 0 END) AS hoge1_count SUM(CASE WHEN hoge = 2 THEN 1 ELSE 0 END) AS hoge2_count - データに対しても投げれるのだが … - keyがNULLだとエラー出るので、無難に CASE WHENしとくのが吉でした
アイスタイルはデータエンジニア募集中!